Class Lz4Support

java.lang.Object
org.opendaylight.raft.spi.Lz4Support

@NonNullByDefault public final class Lz4Support extends Object
Utilities supporting LZ4 compression and decompression.
  • Method Details

    • newDecompressInputStream

      public static InputStream newDecompressInputStream(InputStream in) throws IOException
      Returns a new InputStream that will decompress data using the LZ4 algorithm. This instance will decompress all concatenated frames in their sequential order.
      Parameters:
      in - the stream to decompress
      Returns:
      an InputStream
      Throws:
      IOException - if an I/O error occurs
    • newCompressOutputStream

      public static OutputStream newCompressOutputStream(OutputStream out, Lz4BlockSize blockSize) throws IOException
      Creates a new OutputStream that will compress data using the LZ4 algorithm with independent blocks. Equivalent to
      newCompressOutputStream(out, blockSiize, -1)
      
      .
      Parameters:
      out - the output stream to compress
      blockSize - the block size to use
      Returns:
      an OutputStream
      Throws:
      IOException - if an I/O error occurs
    • newCompressOutputStream

      public static OutputStream newCompressOutputStream(OutputStream out, Lz4BlockSize blockSize, long knownSize) throws IOException
      Creates a new OutputStream that will compress data using the LZ4 algorithm with independent blocks.
      Parameters:
      out - the output stream to compress
      blockSize - the block size to use
      knownSize - the size of the uncompressed data. A value less than zero means unknown.
      Returns:
      an OutputStream
      Throws:
      IOException - if an I/O error occurs