Package com.helger.base.codec
Interface ICharArrayEncoder
- All Superinterfaces:
IEncoder<char[],char[]>
- All Known Subinterfaces:
ICharArrayCodec,ICharArrayStreamEncoder
- All Known Implementing Classes:
RFC2616Codec
- 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 encoder of chars.
- Since:
- 9.3.6
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiondefault char @Nullable []getEncoded(char @Nullable [] aDecodedBuffer) Encode a char array.char @Nullable []getEncoded(char @Nullable [] aDecodedBuffer, int nOfs, int nLen) Encode a char array.default char @Nullable []getEncoded(@Nullable String sDecoded) Encode the passed string.default intgetMaximumEncodedLength(int nDecodedLen) Get the maximum encoded length based on the provided decoded length.
-
Method Details
-
getMaximumEncodedLength
@Nonnegative default int getMaximumEncodedLength(@Nonnegative int nDecodedLen) Get the maximum encoded length based on the provided decoded length. This is purely for performance reasons. The name of the method would be better called "getMaximumEncodedLength".- Parameters:
nDecodedLen- The decoded length. Always ≥ 0.- Returns:
- The maximum encoded length. Always ≥ 0.
-
getEncoded
@ReturnsMutableCopy default char @Nullable [] getEncoded(char @Nullable [] aDecodedBuffer) Encode a char array.- Specified by:
getEncodedin interfaceIEncoder<char[],char[]> - Parameters:
aDecodedBuffer- The char array to be encoded. May benull.- Returns:
- The encoded char array or
nullif the parameter wasnull. - Throws:
EncodeException- In case something goes wrong
-
getEncoded
@ReturnsMutableCopy char @Nullable [] getEncoded(char @Nullable [] aDecodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen) Encode a char array.- Parameters:
aDecodedBuffer- The char array to be encoded. May benull.nOfs- Offset into the char array to start from.nLen- Number of chars starting from offset to consider.- Returns:
- The encoded char array or
nullif the parameter wasnull. - Throws:
EncodeException- In case something goes wrong
-
getEncoded
Encode the passed string.- Parameters:
sDecoded- The string to be encoded. May benull.- Returns:
nullif the input string isnull.- Throws:
EncodeException- In case something goes wrong
-