Interface IByteArrayDecoder

All Superinterfaces:
IDecoder<byte[],byte[]>
All Known Subinterfaces:
IByteArrayCodec, IByteArrayStreamDecoder
All Known Implementing Classes:
ASCII85Codec, ASCIIHexCodec, Base16Codec, Base32Codec, Base64Codec, DCTCodec, FlateCodec, GZIPCodec, IdentityByteArrayCodec, LZWCodec, QuotedPrintableCodec, RunLengthCodec, URLCodec
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IByteArrayDecoder extends IDecoder<byte[],byte[]>
Interface for a single decoder of bytes.
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte[]
    getDecoded(byte[] aEncodedBuffer)
    Decode a byte array.
    byte[]
    getDecoded(byte[] aEncodedBuffer, int nOfs, int nLen)
    Decode a byte array.
    default byte[]
    getDecoded(String sEncoded, Charset aCharset)
    Decode the passed string.
    default int
    getMaximumDecodedLength(int nEncodedLen)
    Get the maximum decoded length based on the provided encoded length.
  • Method Details

    • getMaximumDecodedLength

      @Nonnegative default int getMaximumDecodedLength(@Nonnegative int nEncodedLen)
      Get the maximum decoded length based on the provided encoded length. This is purely for performance reasons.
      Parameters:
      nEncodedLen - The encoded length. Always ≥ 0.
      Returns:
      The maximum decoded length. Always ≥ 0.
      Since:
      9.3.6
    • getDecoded

      @Nullable @ReturnsMutableCopy default byte[] getDecoded(@Nullable byte[] aEncodedBuffer)
      Decode a byte array.
      Specified by:
      getDecoded in interface IDecoder<byte[],byte[]>
      Parameters:
      aEncodedBuffer - The byte array to be decoded. May be null.
      Returns:
      The decoded byte array or null if the parameter was null.
      Throws:
      DecodeException - in case something goes wrong
    • getDecoded

      @Nullable @ReturnsMutableCopy byte[] getDecoded(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen)
      Decode a byte array.
      Parameters:
      aEncodedBuffer - The byte array to be decoded. May be null.
      nOfs - Offset into the byte array to start from.
      nLen - Number of bytes starting from offset to consider.
      Returns:
      The decoded byte array or null if the parameter was null.
      Throws:
      DecodeException - in case something goes wrong
    • getDecoded

      @Nullable @ReturnsMutableCopy default byte[] getDecoded(@Nullable String sEncoded, @Nonnull Charset aCharset)
      Decode the passed string.
      Parameters:
      sEncoded - The string to be decoded. May be null.
      aCharset - The charset to be used. May not be null.
      Returns:
      null if the input string is null.
      Throws:
      DecodeException - in case something goes wrong