Class AcceptEncodingList

java.lang.Object
com.helger.http.header.AbstractQValueList<String>
com.helger.http.header.specific.AcceptEncodingList

@NotThreadSafe public class AcceptEncodingList extends AbstractQValueList<String>
Contains a list of Accept-Encoding values as specified by the HTTP header
Author:
Philip Helger
  • Constructor Details

    • AcceptEncodingList

      public AcceptEncodingList()
  • Method Details

    • addEncoding

      @Nonnull public AcceptEncodingList addEncoding(@Nonnull String sEncoding, @Nonnegative double dQuality)
    • getQValueOfEncoding

      @Nonnull public QValue getQValueOfEncoding(@Nonnull String sEncoding)
      Return the associated quality of the given encoding.
      Parameters:
      sEncoding - The encoding name to query. May not be null.
      Returns:
      The matching QValue and never null.
    • getQualityOfEncoding

      public double getQualityOfEncoding(@Nonnull String sEncoding)
      Return the associated quality of the given encoding.
      Parameters:
      sEncoding - The encoding name to query. May not be null.
      Returns:
      0 means not accepted, 1 means fully accepted.
    • supportsEncoding

      public boolean supportsEncoding(@Nonnull String sEncoding)
      Check if the passed encoding is supported. Supported means the quality is > 0.
      Parameters:
      sEncoding - The encoding to be checked. May not be null.
      Returns:
      true if the encoding is supported, false if not.
    • explicitlySupportsEncoding

      public boolean explicitlySupportsEncoding(@Nonnull String sEncoding)
    • supportsGZIP

      public boolean supportsGZIP()
    • getUsedGZIPEncoding

      @Nullable public String getUsedGZIPEncoding()
      Returns:
      the accepted GZip encoding. May either be AcceptEncodingHandler.GZIP_ENCODING or AcceptEncodingHandler.X_GZIP_ENCODING or null
    • supportsDeflate

      public boolean supportsDeflate()
    • getUsedDeflateEncoding

      @Nullable public String getUsedDeflateEncoding()
      Returns:
      the accepted GZip encoding. May either be AcceptEncodingHandler.DEFLATE_ENCODING or null
    • supportsCompress

      public boolean supportsCompress()
    • getUsedCompressEncoding

      @Nullable public String getUsedCompressEncoding()
      Returns:
      the accepted GZip encoding. May either be AcceptEncodingHandler.COMPRESS_ENCODING or AcceptEncodingHandler.X_COMPRESS_ENCODING or null
    • getAsHttpHeaderValue

      @Nonnull public String getAsHttpHeaderValue()
      Specified by:
      getAsHttpHeaderValue in class AbstractQValueList<String>
      Returns:
      The string representation of this list e.g. for usage in HTTP headers.