Package net.sf.jazzlib
Class PendingBuffer
- java.lang.Object
-
- net.sf.jazzlib.PendingBuffer
-
- Direct Known Subclasses:
DeflaterPending
class PendingBuffer extends java.lang.ObjectThis class is general purpose class for writing data to a buffer. It allows you to write bits as well as bytes Based on DeflaterPending.java
-
-
Constructor Summary
Constructors Constructor Description PendingBuffer()PendingBuffer(int bufsize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalignToByte()intflush(byte[] output, int offset, int length)Flushes the pending buffer into the given output array.intgetBitCount()booleanisFlushed()voidreset()byte[]toByteArray()Flushes the pending buffer and returns that data in a new arrayvoidwriteBits(int b, int count)voidwriteBlock(byte[] block, int offset, int len)voidwriteByte(int b)voidwriteInt(int s)voidwriteShort(int s)voidwriteShortMSB(int s)
-
-
-
Method Detail
-
reset
public final void reset()
-
writeByte
public final void writeByte(int b)
-
writeShort
public final void writeShort(int s)
-
writeInt
public final void writeInt(int s)
-
writeBlock
public final void writeBlock(byte[] block, int offset, int len)
-
getBitCount
public final int getBitCount()
-
alignToByte
public final void alignToByte()
-
writeBits
public final void writeBits(int b, int count)
-
writeShortMSB
public final void writeShortMSB(int s)
-
isFlushed
public final boolean isFlushed()
-
flush
public final int flush(byte[] output, int offset, int length)Flushes the pending buffer into the given output array. If the output array is to small, only a partial flush is done.- Parameters:
output- the output array;offset- the offset into output array;length- the maximum number of bytes to store;- Throws:
java.lang.IndexOutOfBoundsException- if offset or length are invalid.
-
toByteArray
public final byte[] toByteArray()
Flushes the pending buffer and returns that data in a new array- Parameters:
output- the output stream
-
-