Package com.helger.commons.codec
Class RFC2616Codec
- java.lang.Object
-
- com.helger.commons.codec.RFC2616Codec
-
- All Implemented Interfaces:
ICharArrayCodec,ICharArrayDecoder,ICharArrayEncoder,ICharArrayStreamDecoder,ICharArrayStreamEncoder,ICodec<char[]>,IDecoder<char[],char[]>,IEncoder<char[],char[]>
public class RFC2616Codec extends Object implements ICharArrayCodec
Codec for RFC 2616 HTTP header values.- Since:
- 9.3.6
- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description RFC2616Codec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecode(char[] aEncodedBuffer, int nOfs, int nLen, Writer aWriter)Decode (part of) a char array.voidencode(char[] aDecodedBuffer, int nOfs, int nLen, Writer aWriter)Encode (part of) a char array to anWriter.intgetMaximumDecodedLength(int nEncodedLen)Get the maximum decoded length based on the provided encoded length.intgetMaximumEncodedLength(int nDecodedLen)Get the maximum encoded length based on the provided decoded length.static booleanisMaybeEncoded(char[] s)static booleanisMaybeEncoded(String s)static booleanisToken(char[] aChars)static booleanisToken(String s)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.helger.commons.codec.ICharArrayDecoder
getDecoded, getDecoded
-
Methods inherited from interface com.helger.commons.codec.ICharArrayStreamDecoder
decode, getDecoded, getDecodedAsString, getDecodedAsString, getDecodedAsString
-
Methods inherited from interface com.helger.commons.codec.ICharArrayStreamEncoder
encode, getEncoded, getEncoded, getEncoded, getEncodedAsString, getEncodedAsString, getEncodedAsString
-
-
-
-
Method Detail
-
isToken
public static boolean isToken(@Nullable char[] aChars)
-
isMaybeEncoded
public static boolean isMaybeEncoded(@Nullable char[] s)
-
getMaximumEncodedLength
@Nonnegative public int getMaximumEncodedLength(@Nonnegative int nDecodedLen)
Description copied from interface:ICharArrayEncoderGet 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".- Specified by:
getMaximumEncodedLengthin interfaceICharArrayEncoder- Specified by:
getMaximumEncodedLengthin interfaceICharArrayStreamEncoder- Parameters:
nDecodedLen- The decoded length. Always ≥ 0.- Returns:
- The maximum encoded length. Always ≥ 0.
-
encode
public void encode(@Nullable char[] aDecodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull @WillNotClose Writer aWriter)
Description copied from interface:ICharArrayStreamEncoderEncode (part of) a char array to anWriter.- Specified by:
encodein interfaceICharArrayStreamEncoder- 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.aWriter- The writer to write to. May not benulland is NOT closed afterwards!
-
getMaximumDecodedLength
@Nonnegative public int getMaximumDecodedLength(@Nonnegative int nEncodedLen)
Description copied from interface:ICharArrayDecoderGet the maximum decoded length based on the provided encoded length. This is purely for performance reasons.- Specified by:
getMaximumDecodedLengthin interfaceICharArrayDecoder- Parameters:
nEncodedLen- The encoded length. Always ≥ 0.- Returns:
- The maximum decoded length. Always ≥ 0.
-
decode
public void decode(@Nullable char[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull @WillNotClose Writer aWriter)
Description copied from interface:ICharArrayStreamDecoderDecode (part of) a char array.- Specified by:
decodein interfaceICharArrayStreamDecoder- Parameters:
aEncodedBuffer- The char array to be decoded. May benull.nOfs- Offset into the char array to start from.nLen- Number of chars starting from offset to consider.aWriter- The writer to write to. May not benulland is NOT closed afterwards!
-
-