Enum Class GzipStreamInterceptor

java.lang.Object
java.lang.Enum<GzipStreamInterceptor>
com.amazon.ion.util.GzipStreamInterceptor
All Implemented Interfaces:
InputStreamInterceptor, Serializable, Comparable<GzipStreamInterceptor>, Constable

public enum GzipStreamInterceptor extends Enum<GzipStreamInterceptor> implements InputStreamInterceptor
The interceptor for GZIP streams. This is a singleton that may be accessed using INSTANCE.
  • Enum Constant Details

  • Method Details

    • values

      public static GzipStreamInterceptor[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GzipStreamInterceptor valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • formatName

      public String formatName()
      Description copied from interface: InputStreamInterceptor
      The name of the format the interceptor recognizes.
      Specified by:
      formatName in interface InputStreamInterceptor
      Returns:
      a constant String.
    • numberOfBytesNeededToDetermineMatch

      public int numberOfBytesNeededToDetermineMatch()
      Description copied from interface: InputStreamInterceptor
      The number of bytes required to be read from the beginning of the stream in order to determine whether it matches the format relevant to this interceptor. If a stream contains fewer than the number of bytes returned by this method, then this interceptor will not be considered a match and InputStreamInterceptor.isMatch(byte[], int, int) will not be called.
      Specified by:
      numberOfBytesNeededToDetermineMatch in interface InputStreamInterceptor
      Returns:
      the length in bytes.
    • isMatch

      public boolean isMatch(byte[] candidate, int offset, int length)
      Description copied from interface: InputStreamInterceptor
      Determines whether the given candidate byte sequence matches this format.
      Specified by:
      isMatch in interface InputStreamInterceptor
      Parameters:
      candidate - the candidate byte sequence.
      offset - the offset into the candidate bytes to begin matching.
      length - the number of bytes (beginning at 'offset') in `candidate`. Must be greater than or equal to InputStreamInterceptor.numberOfBytesNeededToDetermineMatch().
      Returns:
      true if the candidate byte sequence matches; otherwise, false.
    • newInputStream

      public InputStream newInputStream(InputStream interceptedStream) throws IOException
      Description copied from interface: InputStreamInterceptor
      Creates a new InputStream that transforms the bytes in the given InputStream into valid text or binary Ion.
      Specified by:
      newInputStream in interface InputStreamInterceptor
      Parameters:
      interceptedStream - the stream containing bytes in this format.
      Returns:
      a new InputStream.
      Throws:
      IOException - if thrown when constructing the new InputStream.