Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.export.compressors
Class BitUnpacker

java.lang.Object
  extended by org.web3d.vrml.export.compressors.BitUnpacker

public class BitUnpacker
extends java.lang.Object

UnPack a stream of integers of variables bits from a packed form. Loosely copied from Johnathon Blow's "Packing Integers" article.

Version:
$Revision: 1.3 $
Author:
Alan Hudson

Constructor Summary
BitUnpacker(byte[] buffer)
          Construct a bit unpacker.
 
Method Summary
 long getNumBitsRemaining()
          Get the number of bits remaining to be procesed.
static void main(java.lang.String[] args)
          Small test of unpack/pack routines.
 void reset(byte[] buffer)
          Set this bit unpacker to a new value.
 int unpack(int num_bits)
          Unpack a number of bits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitUnpacker

public BitUnpacker(byte[] buffer)
Construct a bit unpacker.

Parameters:
buffer - The buffer to decode.
Method Detail

unpack

public int unpack(int num_bits)
Unpack a number of bits.


reset

public void reset(byte[] buffer)
Set this bit unpacker to a new value. Resests the postion to the beginning.


getNumBitsRemaining

public long getNumBitsRemaining()
Get the number of bits remaining to be procesed.

Returns:
The number of bits left to process.

main

public static void main(java.lang.String[] args)
Small test of unpack/pack routines.


Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium