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 Details

    • RFC2616Codec

      public RFC2616Codec()
  • Method Details

    • isToken

      public static boolean isToken(@Nullable String s)
    • isToken

      public static boolean isToken(@Nullable char[] aChars)
    • isMaybeEncoded

      public static boolean isMaybeEncoded(@Nullable String s)
    • isMaybeEncoded

      public static boolean isMaybeEncoded(@Nullable char[] s)
    • getMaximumEncodedLength

      @Nonnegative public int getMaximumEncodedLength(@Nonnegative int nDecodedLen)
      Description copied from interface: ICharArrayEncoder
      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".
      Specified by:
      getMaximumEncodedLength in interface ICharArrayEncoder
      Specified by:
      getMaximumEncodedLength in interface ICharArrayStreamEncoder
      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: ICharArrayStreamEncoder
      Encode (part of) a char array to an Writer.
      Specified by:
      encode in interface ICharArrayStreamEncoder
      Parameters:
      aDecodedBuffer - The char array to be encoded. May be null.
      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 be null and is NOT closed afterwards!
    • getMaximumDecodedLength

      @Nonnegative public int getMaximumDecodedLength(@Nonnegative int nEncodedLen)
      Description copied from interface: ICharArrayDecoder
      Get the maximum decoded length based on the provided encoded length. This is purely for performance reasons.
      Specified by:
      getMaximumDecodedLength in interface ICharArrayDecoder
      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: ICharArrayStreamDecoder
      Decode (part of) a char array.
      Specified by:
      decode in interface ICharArrayStreamDecoder
      Parameters:
      aEncodedBuffer - The char array to be decoded. May be null.
      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 be null and is NOT closed afterwards!