Class SnappyCodec

java.lang.Object
org.xerial.snappy.SnappyCodec

public class SnappyCodec extends Object
Preamble header for SnappyOutputStream.

The magic header is the following 8 bytes data:

 -126, 'S', 'N', 'A', 'P', 'P', 'Y', 0
 

  • Field Details

    • MAGIC_HEADER

      static final byte[] MAGIC_HEADER
    • MAGIC_LEN

      public static final int MAGIC_LEN
    • HEADER_SIZE

      public static final int HEADER_SIZE
    • MAGIC_HEADER_HEAD

      public static final int MAGIC_HEADER_HEAD
    • DEFAULT_VERSION

      public static final int DEFAULT_VERSION
      See Also:
    • MINIMUM_COMPATIBLE_VERSION

      public static final int MINIMUM_COMPATIBLE_VERSION
      See Also:
    • currentHeader

      public static final SnappyCodec currentHeader
    • magic

      public final byte[] magic
    • version

      public final int version
    • compatibleVersion

      public final int compatibleVersion
    • headerArray

      private final byte[] headerArray
  • Constructor Details

    • SnappyCodec

      private SnappyCodec(byte[] magic, int version, int compatibleVersion)
  • Method Details

    • getMagicHeader

      public static byte[] getMagicHeader()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • headerSize

      public static int headerSize()
    • writeHeader

      public int writeHeader(byte[] dst, int dstOffset)
    • writeHeader

      public int writeHeader(OutputStream out) throws IOException
      Throws:
      IOException
    • isValidMagicHeader

      public boolean isValidMagicHeader()
    • hasMagicHeaderPrefix

      public static boolean hasMagicHeaderPrefix(byte[] b)
    • readHeader

      public static SnappyCodec readHeader(InputStream in) throws IOException
      Throws:
      IOException