Class BinaryFieldEncoder
java.lang.Object
org.web3d.vrml.export.compressors.BinaryFieldEncoder
- All Implemented Interfaces:
FieldCompressor
,FieldDecompressor
- Direct Known Subclasses:
RangeCompressor
A field compressor that just encodes the data in binary form.
- Version:
- $Revision: 1.7 $
- Author:
- Alan Hudson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSupport
(int fieldType, int method) Can this fieldCompressor support this compression methodvoid
compress
(DataOutputStream dos, int fieldType, boolean data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, boolean[] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, double data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, double[] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, double[][] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, float data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, float[] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, float[][] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, int data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, int[] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, long data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, long[] data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, String data) Compress this field and deposit the output to the bitstreamvoid
compress
(DataOutputStream dos, int fieldType, String[] data) Compress this field and deposit the output to the bitstreamboolean
decompressBoolean
(DataInputStream dis, int fieldType) Decompress this field.void
decompressBoolean
(DataInputStream dis, int fieldType, boolean[] data) Decompress this field.double
decompressDouble
(DataInputStream dis, int fieldType) Decompress this field.void
decompressDouble
(DataInputStream dis, int fieldType, double[] data) Decompress this field.void
decompressDouble
(DataInputStream dis, int fieldType, double[][] data) Decompress this field.float
decompressFloat
(DataInputStream dis, int fieldType) Decompress this field.void
decompressFloat
(DataInputStream dis, int fieldType, float[] data) Decompress this field.If the array is too small it will be realloacted.void
decompressFloat
(DataInputStream dis, int fieldType, float[][] data) Decompress this field.int
decompressInt
(DataInputStream dis, int fieldType) Decompress this field.void
decompressInt
(DataInputStream dis, int fieldType, int[] data) Decompress this field.long
decompressLong
(DataInputStream dis, int fieldType) Decompress this field.void
decompressLong
(DataInputStream dis, int fieldType, long[] data) Decompress this field.decompressString
(DataInputStream dis, int fieldType) Decompress this field.void
decompressString
(DataInputStream dis, int fieldType, String[] data) Decompress this field.int
Get the length of variable length field.
-
Constructor Details
-
BinaryFieldEncoder
public BinaryFieldEncoder()
-
-
Method Details
-
canSupport
public boolean canSupport(int fieldType, int method) Can this fieldCompressor support this compression method- Specified by:
canSupport
in interfaceFieldCompressor
- Specified by:
canSupport
in interfaceFieldDecompressor
- Parameters:
fieldType
- What type of field, defined in FieldConstants.method
- What method of compression. 0-127 defined by Web3D Consortium.- Returns:
-
nextLength
Get the length of variable length field.- Specified by:
nextLength
in interfaceFieldDecompressor
- Parameters:
dis
-- Returns:
- The length of the upcoming field in number of type units.
- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
compress
Compress this field and deposit the output to the bitstream- Specified by:
compress
in interfaceFieldCompressor
- Parameters:
dos
- The stream to output the resultfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressInt
Decompress this field.- Specified by:
decompressInt
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- data The field data
- Throws:
IOException
-
decompressInt
Decompress this field.- Specified by:
decompressInt
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressBoolean
Decompress this field.- Specified by:
decompressBoolean
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- The field value
- Throws:
IOException
-
decompressBoolean
public void decompressBoolean(DataInputStream dis, int fieldType, boolean[] data) throws IOException Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressBoolean
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressFloat
Decompress this field.- Specified by:
decompressFloat
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- The field value
- Throws:
IOException
-
decompressFloat
Decompress this field.If the array is too small it will be realloacted.- Specified by:
decompressFloat
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressFloat
Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressFloat
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressLong
Decompress this field.- Specified by:
decompressLong
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- The field value
- Throws:
IOException
-
decompressLong
Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressLong
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressDouble
Decompress this field.- Specified by:
decompressDouble
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- The field value
- Throws:
IOException
-
decompressDouble
Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressDouble
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressDouble
public void decompressDouble(DataInputStream dis, int fieldType, double[][] data) throws IOException Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressDouble
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-
decompressString
Decompress this field.- Specified by:
decompressString
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.- Returns:
- The field value
- Throws:
IOException
-
decompressString
Decompress this field. If the array is too small it will be realloacted.- Specified by:
decompressString
in interfaceFieldDecompressor
- Parameters:
dis
- The stream to read fromfieldType
- The type of field to compress from FieldConstants.data
- The field data- Throws:
IOException
-