com.bigzip.plugin.compression.io
Class NullCompression

java.lang.Object
  |
  +--com.bigzip.plugin.compression.io.NullCompression
All Implemented Interfaces:
Compressor

public class NullCompression
extends java.lang.Object
implements Compressor


Constructor Summary
NullCompression()
           
 
Method Summary
 Compressor createInstance()
          Creates a new instance of the implemented Compressor class.
 int deflate(byte[] b)
          Fills specified buffer with compressed data.
 int deflate(byte[] b, int off, int len)
          Fills specified buffer with compressed data.
 void end()
          Discards unprocessed input and frees internal data.
 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.
 java.lang.String getName()
           
 int getTotalIn()
          Returns the total number of bytes input so far.
 int getTotalOut()
          Returns the total number of bytes output so far.
 int getVersion()
          return version number of the engine, in this case "0".
 boolean needsInput()
          Returns true if the input data buffer is empty and setInput() should be called in order to provide more input.
 void reset()
          Resets deflater so that a new set of input data can be processed.
 void setDictionary(byte[] b)
          Sets preset dictionary for compression.
 void setDictionary(byte[] b, int off, int len)
          Sets preset dictionary for compression.
 void setInput(byte[] b)
          Sets input data for compression.
 void setInput(byte[] b, int off, int len)
          Sets input data for compression.
 void setLevel(int level)
          Sets the current compression level to the specified value.
 void setStrategy(int strategy)
          Sets the compression strategy to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullCompression

public NullCompression()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Compressor
Returns:
the engine name, in tnis case "null".

getVersion

public int getVersion()
return version number of the engine, in this case "0".
Specified by:
getVersion in interface Compressor
Following copied from interface: com.bigzip.plugin.compression.engine.Compressor
Returns:
the version of the engine

setInput

public void setInput(byte[] b,
                     int off,
                     int len)
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required.
Specified by:
setInput in interface Compressor
Parameters:
b - the input data bytes
off - the start offset of the data
len - the length of the data
See Also:
Deflater#needsInput

setInput

public void setInput(byte[] b)
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required.
Specified by:
setInput in interface Compressor
Parameters:
b - the input data bytes
See Also:
Deflater#needsInput

setDictionary

public void setDictionary(byte[] b,
                          int off,
                          int len)
Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined. When the data is later uncompressed with Inflater.inflate(), Inflater.getAdler() can be called in order to get the Adler-32 value of the dictionary required for decompression.
Specified by:
setDictionary in interface Compressor
Parameters:
b - the dictionary data bytes
off - the start offset of the data
len - the length of the data
See Also:
Inflater#inflate, Inflater#getAdler

setDictionary

public void setDictionary(byte[] b)
Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined. When the data is later uncompressed with Inflater.inflate(), Inflater.getAdler() can be called in order to get the Adler-32 value of the dictionary required for decompression.
Specified by:
setDictionary in interface Compressor
Parameters:
b - the dictionary data bytes
See Also:
Inflater#inflate, Inflater#getAdler

setStrategy

public void setStrategy(int strategy)
Sets the compression strategy to the specified value.
Specified by:
setStrategy in interface Compressor
Parameters:
strategy - the new compression strategy
Throws:
java.lang.IllegalArgumentException - if the compression strategy is invalid

setLevel

public void setLevel(int level)
Sets the current compression level to the specified value.
Specified by:
setLevel in interface Compressor
Parameters:
level - the new compression level
Throws:
java.lang.IllegalArgumentException - if the compression level is invalid

needsInput

public boolean needsInput()
Returns true if the input data buffer is empty and setInput() should be called in order to provide more input.
Specified by:
needsInput in interface Compressor

finish

public void finish()
When called, indicates that compression should end with the current contents of the input buffer.
Specified by:
finish in interface Compressor

finished

public boolean finished()
Returns true if the end of the compressed data output stream has been reached.
Specified by:
finished in interface Compressor

deflate

public int deflate(byte[] b,
                   int off,
                   int len)
Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.
Specified by:
deflate in interface Compressor
Parameters:
b - the buffer for the compressed data
off - the start offset of the data
len - the maximum number of bytes of compressed data
Returns:
the actual number of bytes of compressed data

deflate

public int deflate(byte[] b)
Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.
Specified by:
deflate in interface Compressor
Parameters:
b - the buffer for the compressed data
Returns:
the actual number of bytes of compressed data

getTotalIn

public int getTotalIn()
Returns the total number of bytes input so far.
Specified by:
getTotalIn in interface Compressor

getTotalOut

public int getTotalOut()
Returns the total number of bytes output so far.
Specified by:
getTotalOut in interface Compressor

reset

public void reset()
Resets deflater so that a new set of input data can be processed. Keeps current compression level and strategy settings.
Specified by:
reset in interface Compressor

end

public void end()
Discards unprocessed input and frees internal data.
Specified by:
end in interface Compressor

createInstance

public Compressor createInstance()
Creates a new instance of the implemented Compressor class.
Specified by:
createInstance in interface Compressor