Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ClassLib.Common.java.util.zip
Class StreamManipulator  view StreamManipulator download StreamManipulator.java

java.lang.Object
  extended byClassLib.Common.java.util.zip.StreamManipulator

class StreamManipulator
extends java.lang.Object

StreamManipulator

Version:
$Id: StreamManipulator.java,v 1.4 2003/05/12 10:04:53 joewhaley Exp $

Field Summary
private  int bits_in_buffer
           
private  int buffer
           
private  byte[] window
           
private  int window_end
           
private  int window_start
           
 
Constructor Summary
StreamManipulator()
           
 
Method Summary
 int copyBytes(byte[] output, int offset, int length)
           
 void dropBits(int n)
           
 int getAvailableBits()
          Gets the number of bits available in the bit buffer.
 int getAvailableBytes()
          Gets the number of bytes available.
 int getBits(int n)
          Gets the next n bits and increases input pointer.
 boolean needsInput()
           
 int peekBits(int n)
          Get the next n bits but don't increase input pointer.
 void reset()
           
 void setInput(byte[] buf, int off, int len)
           
 void skipToByteBoundary()
          Skips to the next byte boundary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

window

private byte[] window

window_start

private int window_start

window_end

private int window_end

buffer

private int buffer

bits_in_buffer

private int bits_in_buffer
Constructor Detail

StreamManipulator

public StreamManipulator()
Method Detail

peekBits

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.


dropBits

public final void dropBits(int n)

getBits

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.


getAvailableBits

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.


getAvailableBytes

public final int getAvailableBytes()
Gets the number of bytes available.


skipToByteBoundary

public void skipToByteBoundary()
Skips to the next byte boundary.


needsInput

public final boolean needsInput()

copyBytes

public int copyBytes(byte[] output,
                     int offset,
                     int length)

reset

public void reset()

setInput

public void setInput(byte[] buf,
                     int off,
                     int len)