Xj3D VRML/X3D Code API

org.web3d.vrml.export.compressors
Class HuffmanTable

java.lang.Object
  extended byorg.web3d.vrml.export.compressors.HuffmanTable

public class HuffmanTable
extends java.lang.Object

Prototype Huffman node. Borrowed original impl from Sun HuffmanNode, need to decide if copyright still stands for heavily modified code.

Version:
$Revision: 1.4 $
Author:
Alan Hudson

Method Summary
 void clear()
          Clear this HuffmanTable instance.
 void computeTags()
          Compute optimized tags for each position, color, and normal entry.
 void decode(byte[] tags, int[] data)
          Decode a tag into a HuffmanNode.
 HuffmanNode getEntry(HuffmanNode node)
           
 void print()
          Print the contents of this instance to standard out.
 void readDict(java.io.InputStream dis)
          Read the dictonary from a stream.
 void setDataLength(int dataLength)
          Set the length of each data element in bits.
 int streamBits()
          Get the total number of bits needed to writeout the stream used to create this table.
 void writeDict(java.io.DataOutputStream dos)
          Write the dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setDataLength

public void setDataLength(int dataLength)
Set the length of each data element in bits.

Parameters:
dataLength - The length.

streamBits

public int streamBits()
Get the total number of bits needed to writeout the stream used to create this table.

Returns:
The number of bits

getEntry

public HuffmanNode getEntry(HuffmanNode node)

writeDict

public void writeDict(java.io.DataOutputStream dos)
               throws java.io.IOException
Write the dictionary.

Parameters:
dos - The stream to write to.
Throws:
java.io.IOException

readDict

public void readDict(java.io.InputStream dis)
              throws java.io.IOException
Read the dictonary from a stream.

Parameters:
dis - The stream.
Throws:
java.io.IOException

decode

public void decode(byte[] tags,
                   int[] data)
Decode a tag into a HuffmanNode.

Parameters:
tags - The huffman tag
data - An array to put the decoded node into

clear

public void clear()
Clear this HuffmanTable instance.


computeTags

public void computeTags()
Compute optimized tags for each position, color, and normal entry.


print

public void print()
Print the contents of this instance to standard out.


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium