Package com.helger.commons.codec
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
All Methods Instance Methods Abstract Methods Default Methods 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 intgetMaximumDecodedLength(int nEncodedLen)Get the maximum decoded length based on the provided encoded length.
-
-
-
Method Detail
-
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:
getDecodedin interfaceIDecoder<byte[],byte[]>- Parameters:
aEncodedBuffer- The byte array to be decoded. May benull.- Returns:
- The decoded byte array or
nullif the parameter wasnull. - 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 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
-
getDecoded
@Nullable @ReturnsMutableCopy default byte[] getDecoded(@Nullable String sEncoded, @Nonnull Charset aCharset)
Decode the passed string.- Parameters:
sEncoded- The string to be decoded. May benull.aCharset- The charset to be used. May not benull.- Returns:
nullif the input string isnull.- Throws:
DecodeException- in case something goes wrong
-
-