Interface IByteArrayStreamDecoder

All Superinterfaces:
IByteArrayDecoder, IDecoder<byte[],byte[]>
All Known Subinterfaces:
IByteArrayCodec
All Known Implementing Classes:
ASCII85Codec, ASCIIHexCodec, Base16Codec, Base32Codec, Base64Codec, 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 IByteArrayStreamDecoder extends IByteArrayDecoder
Interface for a single decoder of bytes, based on streams.
Author:
Philip Helger
  • Method Details

    • decode

      default void decode(@Nullable byte[] aEncodedBuffer, @Nonnull @WillNotClose OutputStream aOS)
      Decode a byte array.
      Parameters:
      aEncodedBuffer - The byte array to be decoded. May be null.
      aOS - The output stream to write to. May not be null and is NOT closed afterwards!
      Throws:
      DecodeException - in case something goes wrong
      Since:
      9.0.0
    • decode

      void decode(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull @WillNotClose OutputStream aOS)
      Decode (part of) 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.
      aOS - The output stream to write to. May not be null and is NOT closed afterwards!
      Throws:
      DecodeException - in case something goes wrong
    • getDecoded

      @Nullable @ReturnsMutableCopy default byte[] getDecoded(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen)
      Decode a byte array.
      Specified by:
      getDecoded in interface IByteArrayDecoder
      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
    • getDecodedAsString

      @Nullable default String getDecodedAsString(@Nullable byte[] aEncodedBuffer, @Nonnull Charset aCharset)
    • getDecodedAsString

      @Nullable default String getDecodedAsString(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull Charset aCharset)
    • getDecodedAsString

      @Nullable default String getDecodedAsString(@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 for encoding AND decoding. May not be null.
      Returns:
      null if the input string is null.
      Throws:
      DecodeException - in case something goes wrong
    • getDecodedAsString

      @Nullable default String getDecodedAsString(@Nullable String sEncoded, @Nonnull Charset aEncodedCharset, @Nonnull Charset aDecodedCharset)
      Decode the passed string.
      Parameters:
      sEncoded - The string to be decoded. May be null.
      aEncodedCharset - The charset to be used for the encoded string. May not be null.
      aDecodedCharset - The charset to be used for the decoded result string. May not be null.
      Returns:
      null if the input string is null.
      Throws:
      DecodeException - in case something goes wrong
      Since:
      9.3.6