public class SnappyCompressor extends Object implements Compressor
Compressor
based on the snappy compression algorithm.
http://code.google.com/p/snappy/Constructor and Description |
---|
SnappyCompressor()
Creates a new compressor with the default buffer size.
|
SnappyCompressor(int directBufferSize)
Creates a new compressor.
|
Modifier and Type | Method and Description |
---|---|
int |
compress(byte[] b,
int off,
int len)
Fills specified buffer with compressed data.
|
void |
end()
Closes the compressor and discards any unprocessed input.
|
void |
finish()
When called, indicates that compression should end
with the current contents of the input buffer.
|
boolean |
finished()
Returns true if the end of the compressed
data output stream has been reached.
|
long |
getBytesRead()
Return number of bytes given to this compressor since last reset.
|
long |
getBytesWritten()
Return number of bytes consumed by callers of compress since last reset.
|
static String |
getLibraryName() |
static boolean |
isNativeCodeLoaded() |
boolean |
needsInput()
Returns true if the input data buffer is empty and
#setInput() should be called to provide more input.
|
void |
reinit(Configuration conf)
Prepare the compressor to be used in a new stream with settings defined in
the given Configuration
|
void |
reset()
Resets compressor so that a new set of input data can be processed.
|
void |
setDictionary(byte[] b,
int off,
int len)
Does nothing.
|
void |
setInput(byte[] b,
int off,
int len)
Sets input data for compression.
|
public SnappyCompressor(int directBufferSize)
directBufferSize
- size of the direct buffer to be used.public SnappyCompressor()
public static boolean isNativeCodeLoaded()
public void setInput(byte[] b, int off, int len)
true
indicating that more input data is required.setInput
in interface Compressor
b
- Input dataoff
- Start offsetlen
- Lengthpublic void setDictionary(byte[] b, int off, int len)
setDictionary
in interface Compressor
b
- Dictionary data bytesoff
- Start offsetlen
- Lengthpublic boolean needsInput()
needsInput
in interface Compressor
true
if the input data buffer is empty and
#setInput() should be called in order to provide more input.public void finish()
finish
in interface Compressor
public boolean finished()
finished
in interface Compressor
true
if the end of the compressed
data output stream has been reached.public int compress(byte[] b, int off, int len) throws IOException
compress
in interface Compressor
b
- Buffer for the compressed dataoff
- Start offset of the datalen
- Size of the bufferIOException
public void reset()
reset
in interface Compressor
public void reinit(Configuration conf)
reinit
in interface Compressor
conf
- Configuration from which new setting are fetchedpublic long getBytesRead()
getBytesRead
in interface Compressor
public long getBytesWritten()
getBytesWritten
in interface Compressor
public void end()
end
in interface Compressor
public static String getLibraryName()
Copyright © 2013 Apache Software Foundation. All rights reserved.