Xj3D VRML/X3D Code API

org.web3d.vrml.export.compressors
Class BinaryFieldEncoder

java.lang.Object
  extended byorg.web3d.vrml.export.compressors.BinaryFieldEncoder
All Implemented Interfaces:
FieldCompressor, FieldDecompressor
Direct Known Subclasses:
RangeCompressor

public class BinaryFieldEncoder
extends java.lang.Object
implements FieldCompressor, FieldDecompressor

A field compressor that just encodes the data in binary form.

Version:
$Revision: 1.6 $
Author:
Alan Hudson

Constructor Summary
BinaryFieldEncoder()
           
 
Method Summary
 boolean canSupport(int fieldType, int method)
          Can this fieldCompressor support this compression method
 void compress(java.io.DataOutputStream dos, int fieldType, boolean data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, boolean[] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, double data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, double[] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, double[][] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, float data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, float[] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, float[][] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, int data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, int[] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, long data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, long[] data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, java.lang.String data)
          Compress this field and deposit the output to the bitstream
 void compress(java.io.DataOutputStream dos, int fieldType, java.lang.String[] data)
          Compress this field and deposit the output to the bitstream
 boolean decompressBoolean(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressBoolean(java.io.DataInputStream dis, int fieldType, boolean[] data)
          Decompress this field.
 double decompressDouble(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressDouble(java.io.DataInputStream dis, int fieldType, double[] data)
          Decompress this field.
 void decompressDouble(java.io.DataInputStream dis, int fieldType, double[][] data)
          Decompress this field.
 float decompressFloat(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressFloat(java.io.DataInputStream dis, int fieldType, float[] data)
          Decompress this field.If the array is too small it will be realloacted.
 void decompressFloat(java.io.DataInputStream dis, int fieldType, float[][] data)
          Decompress this field.
 int decompressInt(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressInt(java.io.DataInputStream dis, int fieldType, int[] data)
          Decompress this field.
 long decompressLong(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressLong(java.io.DataInputStream dis, int fieldType, long[] data)
          Decompress this field.
 java.lang.String decompressString(java.io.DataInputStream dis, int fieldType)
          Decompress this field.
 void decompressString(java.io.DataInputStream dis, int fieldType, java.lang.String[] data)
          Decompress this field.
 int nextLength(java.io.DataInputStream dis)
          Get the length of variable length field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryFieldEncoder

public BinaryFieldEncoder()
Method Detail

canSupport

public boolean canSupport(int fieldType,
                          int method)
Can this fieldCompressor support this compression method

Specified by:
canSupport in interface FieldCompressor
Parameters:
fieldType - What type of field, defined in FieldConstants.
method - What method of compression. 0-127 defined by Web3D Consortium.

nextLength

public int nextLength(java.io.DataInputStream dis)
               throws java.io.IOException
Get the length of variable length field.

Specified by:
nextLength in interface FieldDecompressor
Returns:
The length of the upcoming field in number of type units.
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     int data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     int[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     boolean data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     boolean[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     float data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     float[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     float[][] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     long data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     long[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     double data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     double[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     double[][] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     java.lang.String data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

compress

public void compress(java.io.DataOutputStream dos,
                     int fieldType,
                     java.lang.String[] data)
              throws java.io.IOException
Compress this field and deposit the output to the bitstream

Specified by:
compress in interface FieldCompressor
Parameters:
dos - The stream to output the result
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressInt

public int decompressInt(java.io.DataInputStream dis,
                         int fieldType)
                  throws java.io.IOException
Decompress this field.

Specified by:
decompressInt in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
data The field data
Throws:
java.io.IOException

decompressInt

public void decompressInt(java.io.DataInputStream dis,
                          int fieldType,
                          int[] data)
                   throws java.io.IOException
Decompress this field.

Specified by:
decompressInt in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressBoolean

public boolean decompressBoolean(java.io.DataInputStream dis,
                                 int fieldType)
                          throws java.io.IOException
Decompress this field.

Specified by:
decompressBoolean in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
The field value
Throws:
java.io.IOException

decompressBoolean

public void decompressBoolean(java.io.DataInputStream dis,
                              int fieldType,
                              boolean[] data)
                       throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressBoolean in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Returns:
The length
Throws:
java.io.IOException

decompressFloat

public float decompressFloat(java.io.DataInputStream dis,
                             int fieldType)
                      throws java.io.IOException
Decompress this field.

Specified by:
decompressFloat in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
The field value
Throws:
java.io.IOException

decompressFloat

public void decompressFloat(java.io.DataInputStream dis,
                            int fieldType,
                            float[] data)
                     throws java.io.IOException
Decompress this field.If the array is too small it will be realloacted.

Specified by:
decompressFloat in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressFloat

public void decompressFloat(java.io.DataInputStream dis,
                            int fieldType,
                            float[][] data)
                     throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressFloat in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressLong

public long decompressLong(java.io.DataInputStream dis,
                           int fieldType)
                    throws java.io.IOException
Decompress this field.

Specified by:
decompressLong in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
The field value
Throws:
java.io.IOException

decompressLong

public void decompressLong(java.io.DataInputStream dis,
                           int fieldType,
                           long[] data)
                    throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressLong in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressDouble

public double decompressDouble(java.io.DataInputStream dis,
                               int fieldType)
                        throws java.io.IOException
Decompress this field.

Specified by:
decompressDouble in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
The field value
Throws:
java.io.IOException

decompressDouble

public void decompressDouble(java.io.DataInputStream dis,
                             int fieldType,
                             double[] data)
                      throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressDouble in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressDouble

public void decompressDouble(java.io.DataInputStream dis,
                             int fieldType,
                             double[][] data)
                      throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressDouble in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

decompressString

public java.lang.String decompressString(java.io.DataInputStream dis,
                                         int fieldType)
                                  throws java.io.IOException
Decompress this field.

Specified by:
decompressString in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
Returns:
The field value
Throws:
java.io.IOException

decompressString

public void decompressString(java.io.DataInputStream dis,
                             int fieldType,
                             java.lang.String[] data)
                      throws java.io.IOException
Decompress this field. If the array is too small it will be realloacted.

Specified by:
decompressString in interface FieldDecompressor
Parameters:
dis - The stream to read from
fieldType - The type of field to compress from FieldConstants.
data - The field data
Throws:
java.io.IOException

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium