voldemort.store.compress
Class StreamCompressionStrategy

java.lang.Object
  extended by voldemort.store.compress.StreamCompressionStrategy
All Implemented Interfaces:
CompressionStrategy
Direct Known Subclasses:
GzipCompressionStrategy, SnappyCompressionStrategy

public abstract class StreamCompressionStrategy
extends java.lang.Object
implements CompressionStrategy

Useful base class for stream-based compression strategies.


Constructor Summary
StreamCompressionStrategy()
           
 
Method Summary
 byte[] deflate(byte[] data)
          Compresses the data.
 byte[] inflate(byte[] data)
          Uncompresses the data.
protected abstract  java.io.InputStream wrapInputStream(java.io.InputStream underlying)
           
protected abstract  java.io.OutputStream wrapOutputStream(java.io.OutputStream underlying)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface voldemort.store.compress.CompressionStrategy
getType
 

Constructor Detail

StreamCompressionStrategy

public StreamCompressionStrategy()
Method Detail

deflate

public byte[] deflate(byte[] data)
               throws java.io.IOException
Description copied from interface: CompressionStrategy
Compresses the data. The array received should not be modified, but it may be returned unchanged.

Specified by:
deflate in interface CompressionStrategy
Parameters:
data - uncompressed data.
Returns:
compressed data.
Throws:
java.io.IOException - if there is an issue during the operation.

wrapOutputStream

protected abstract java.io.OutputStream wrapOutputStream(java.io.OutputStream underlying)
                                                  throws java.io.IOException
Throws:
java.io.IOException

wrapInputStream

protected abstract java.io.InputStream wrapInputStream(java.io.InputStream underlying)
                                                throws java.io.IOException
Throws:
java.io.IOException

inflate

public byte[] inflate(byte[] data)
               throws java.io.IOException
Description copied from interface: CompressionStrategy
Uncompresses the data. The array received should not be modified, but it may be returned unchanged.

Specified by:
inflate in interface CompressionStrategy
Parameters:
data - compressed data.
Returns:
uncompressed data.
Throws:
java.io.IOException - if there is an issue during the operation.


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu