Save This Page
Home » openjdk-7 » java » util » zip » [javadoc | source]
java.util.zip
class: StreamManipulator [javadoc | source]
java.lang.Object
   java.util.zip.StreamManipulator
This class allows us to retrieve a specified amount of bits from the input buffer, as well as copy big byte blocks. It uses an int buffer to store up to 31 bits for direct manipulation. This guarantees that we can get at least 16 bits, but we only need at most 15, so this is all safe. There are some optimizations in this class, for example, you must never peek more then 8 bits more than needed, and you must first peek bits before you may drop them. This is not a general purpose class but optimized for the behaviour of the Inflater.
Constructor:
 public StreamManipulator() 
Method from java.util.zip.StreamManipulator Summary:
copyBytes,   dropBits,   getAvailableBits,   getAvailableBytes,   getBits,   needsInput,   peekBits,   reset,   setInput,   skipToByteBoundary
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.zip.StreamManipulator Detail:
 public int copyBytes(byte[] output,
    int offset,
    int length) 
 public final  void dropBits(int n) 
 public final int getAvailableBits() 
    Gets the number of bits available in the bit buffer. This must be only called when a previous peekBits() returned -1.
 public final int getAvailableBytes() 
    Gets the number of bytes available.
 public final int getBits(int n) 
    Gets the next n bits and increases input pointer. This is equivalent to peekBits followed by dropBits, except for correct error handling.
 public final boolean needsInput() 
 public final int peekBits(int n) 
    Get the next n bits but don't increase input pointer. n must be less or equal 16 and if you if this call succeeds, you must drop at least n-8 bits in the next call.
 public  void reset() 
 public  void setInput(byte[] buf,
    int off,
    int len) 
 public  void skipToByteBoundary() 
    Skips to the next byte boundary.