Package com.helger.base.codec
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,RFC3986Codec,RunLengthCodec
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for a single decoder of bytes, based on streams.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(byte @Nullable [] aEncodedBuffer, int nOfs, int nLen, @NonNull OutputStream aOS) Decode (part of) a byte array.default voiddecode(byte @Nullable [] aEncodedBuffer, @NonNull OutputStream aOS) Decode a byte array.default byte @Nullable []getDecoded(byte @Nullable [] aEncodedBuffer, int nOfs, int nLen) Decode a byte array.default @Nullable StringgetDecodedAsString(byte @Nullable [] aEncodedBuffer, int nOfs, int nLen, @NonNull Charset aCharset) Decode a portion of a byte array and return the result as a string.default @Nullable StringgetDecodedAsString(byte @Nullable [] aEncodedBuffer, @NonNull Charset aCharset) Decode a byte array and return the result as a string.default @Nullable StringgetDecodedAsString(@Nullable String sEncoded, @NonNull Charset aCharset) Decode the passed string.default @Nullable StringgetDecodedAsString(@Nullable String sEncoded, @NonNull Charset aEncodedCharset, @NonNull Charset aDecodedCharset) Decode the passed string.Methods inherited from interface com.helger.base.codec.IByteArrayDecoder
getDecoded, getDecoded, getMaximumDecodedLength
-
Method Details
-
decode
Decode a byte array.- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.aOS- The output stream to write to. May not benulland is NOT closed afterwards!- Throws:
DecodeException- in case something goes wrong- Since:
- 9.0.0
-
decode
void decode(byte @Nullable [] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @WillNotClose @NonNull OutputStream aOS) Decode (part of) a byte array.- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.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 benulland is NOT closed afterwards!- Throws:
DecodeException- in case something goes wrong
-
getDecoded
@ReturnsMutableCopy default byte @Nullable [] getDecoded(byte @Nullable [] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen) Decode a byte array.- Specified by:
getDecodedin interfaceIByteArrayDecoder- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.nOfs- Offset into the byte array to start from.nLen- Number of bytes starting from offset to consider.- Returns:
- The decoded byte array or
nullif the parameter wasnull. - Throws:
DecodeException- in case something goes wrong
-
getDecodedAsString
default @Nullable String getDecodedAsString(byte @Nullable [] aEncodedBuffer, @NonNull Charset aCharset) Decode a byte array and return the result as a string.- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.aCharset- The charset to be used for the result string. May not benull.- Returns:
nullif the input buffer isnull.- Throws:
DecodeException- in case something goes wrong
-
getDecodedAsString
default @Nullable String getDecodedAsString(byte @Nullable [] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Charset aCharset) Decode a portion of a byte array and return the result as a string.- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.nOfs- Offset into the byte array to start from.nLen- Number of bytes starting from offset to consider.aCharset- The charset to be used for the result string. May not benull.- Returns:
nullif the input buffer isnull.- Throws:
DecodeException- in case something goes wrong
-
getDecodedAsString
Decode the passed string.- Parameters:
sEncoded- The string to be decoded. May benull.aCharset- The charset to be used for encoding AND decoding. May not benull.- Returns:
nullif the input string isnull.- Throws:
DecodeException- in case something goes wrong
-
getDecodedAsString
default @Nullable String getDecodedAsString(@Nullable String sEncoded, @NonNull Charset aEncodedCharset, @NonNull Charset aDecodedCharset) Decode the passed string.- Parameters:
sEncoded- The string to be decoded. May benull.aEncodedCharset- The charset to be used for the encoded string. May not benull.aDecodedCharset- The charset to be used for the decoded result string. May not benull.- Returns:
nullif the input string isnull.- Throws:
DecodeException- in case something goes wrong- Since:
- 9.3.6
-