com.bigzip.plugin.compression.io
Class NullDecompression

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

public class NullDecompression
extends java.lang.Object
implements Decompressor


Constructor Summary
NullDecompression()
           
 
Method Summary
 Decompressor createInstance()
          Creates a new instance of the implemented Decompressor class.
 void end()
          Discards unprocessed input and frees internal data.
 boolean finished()
          Return true if the end of the compressed data stream has been reached.
 java.lang.String getName()
           
 int getRemaining()
          Returns the total number of bytes remaining in the input buffer.
 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".
 int inflate(byte[] b)
          Uncompresses bytes into specified buffer.
 int inflate(byte[] b, int off, int len)
          Uncompresses bytes into specified buffer.
 boolean needsDictionary()
          Returns true if a preset dictionary is needed for decompression.
 boolean needsInput()
          Returns true if no data remains in the input buffer.
 void reset()
          Resets inflater so that a new set of input data can be processed.
 void setDictionary(byte[] b)
          Sets the preset dictionary to the given array of bytes.
 void setDictionary(byte[] b, int off, int len)
          Sets the preset dictionary to the given array of bytes.
 void setInput(byte[] b)
          Sets input data for decompression.
 void setInput(byte[] b, int off, int len)
          Sets input data for decompression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullDecompression

public NullDecompression()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Decompressor
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 Decompressor
Following copied from interface: com.bigzip.plugin.compression.engine.Decompressor
Returns:
the version of the engine

setInput

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

setInput

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

setDictionary

public void setDictionary(byte[] b,
                          int off,
                          int len)
Sets the preset dictionary to the given array of bytes. Should be called when inflate() returns 0 and needsDictionary() returns true indicating that a preset dictionary is required. The method getAdler() can be used to get the Adler-32 value of the dictionary needed.
Specified by:
setDictionary in interface Decompressor
Parameters:
b - the dictionary data bytes
off - the start offset of the data
len - the length of the data
See Also:
Inflater#needsDictionary, Inflater#getAdler

setDictionary

public void setDictionary(byte[] b)
Sets the preset dictionary to the given array of bytes. Should be called when inflate() returns 0 and needsDictionary() returns true indicating that a preset dictionary is required. The method getAdler() can be used to get the Adler-32 value of the dictionary needed.
Specified by:
setDictionary in interface Decompressor
Parameters:
b - the dictionary data bytes
See Also:
Inflater#needsDictionary, Inflater#getAdler

getRemaining

public int getRemaining()
Returns the total number of bytes remaining in the input buffer. This can be used to find out what bytes still remain in the input buffer after decompression has finished.
Specified by:
getRemaining in interface Decompressor

needsInput

public boolean needsInput()
Returns true if no data remains in the input buffer. This can be used to determine if #setInput should be called in order to provide more input.
Specified by:
needsInput in interface Decompressor

needsDictionary

public boolean needsDictionary()
Returns true if a preset dictionary is needed for decompression.
Specified by:
needsDictionary in interface Decompressor
See Also:
InflatesetDictionary

finished

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

inflate

public int inflate(byte[] b,
                   int off,
                   int len)
            throws java.util.zip.DataFormatException
Uncompresses bytes into specified buffer. Returns actual number of bytes uncompressed. A return value of 0 indicates that needsInput() or needsDictionary() should be called in order to determine if more input data or a preset dictionary is required. In the later case, getAdler() can be used to get the Adler-32 value of the dictionary required.
Specified by:
inflate in interface Decompressor
Parameters:
b - the buffer for the uncompressed data
off - the start offset of the data
len - the maximum number of uncompressed bytes
Returns:
the actual number of uncompressed bytes
Throws:
java.util.zip.DataFormatException - if the compressed data format is invalid
See Also:
Inflater#needsInput, Inflater#needsDictionary

inflate

public int inflate(byte[] b)
            throws java.util.zip.DataFormatException
Uncompresses bytes into specified buffer. Returns actual number of bytes uncompressed. A return value of 0 indicates that needsInput() or needsDictionary() should be called in order to determine if more input data or a preset dictionary is required. In the later case, getAdler() can be used to get the Adler-32 value of the dictionary required.
Specified by:
inflate in interface Decompressor
Parameters:
b - the buffer for the uncompressed data
Returns:
the actual number of uncompressed bytes
Throws:
java.util.zip.DataFormatException - if the compressed data format is invalid
See Also:
Inflater#needsInput, Inflater#needsDictionary

getTotalIn

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

getTotalOut

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

reset

public void reset()
Resets inflater so that a new set of input data can be processed.
Specified by:
reset in interface Decompressor

end

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

createInstance

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