Class Snappy


  • public final class Snappy
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Snappy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] compress​(byte[] data)  
      static int compress​(byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset)  
      static java.io.InputStream determineSnappyInputStream​(java.io.InputStream source, boolean verifyChecksums)
      Uses the stream marker bytes to determine if the SnappyFramedInputStream or SnappyInputStream should be used to decompress the content of source.
      static int getUncompressedLength​(byte[] compressed, int compressedOffset)  
      static int maxCompressedLength​(int sourceLength)  
      static byte[] uncompress​(byte[] compressed, int compressedOffset, int compressedSize)  
      static int uncompress​(byte[] compressed, int compressedOffset, int compressedSize, byte[] uncompressed, int uncompressedOffset)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Snappy

        private Snappy()
    • Method Detail

      • determineSnappyInputStream

        public static java.io.InputStream determineSnappyInputStream​(java.io.InputStream source,
                                                                     boolean verifyChecksums)
                                                              throws java.io.IOException
        Uses the stream marker bytes to determine if the SnappyFramedInputStream or SnappyInputStream should be used to decompress the content of source.
        Parameters:
        source - The compressed content to decompress. Must support {@link InputStream#mark(int).}
        verifyChecksums - Indicates if the crc32-c checksums should be calculated and verified.
        Returns:
        An appropriate InputStream implementation to decompress the content.
        Throws:
        java.lang.IllegalArgumentException - If source does not support mark/reset or does not contain the appropriate marker bytes for either implementation.
        java.io.IOException
      • uncompress

        public static int uncompress​(byte[] compressed,
                                     int compressedOffset,
                                     int compressedSize,
                                     byte[] uncompressed,
                                     int uncompressedOffset)
                              throws CorruptionException
        Throws:
        CorruptionException
      • maxCompressedLength

        public static int maxCompressedLength​(int sourceLength)
      • compress

        public static int compress​(byte[] uncompressed,
                                   int uncompressedOffset,
                                   int uncompressedLength,
                                   byte[] compressed,
                                   int compressedOffset)
      • compress

        public static byte[] compress​(byte[] data)