This class provides methods to read and write compressed geometry resource
files. These files usually end with the .cg extension and support
sequential as well as random access to multiple compressed geometry
objects.
since: Java 3D 1.5
Field Summary
final static int
ALPHA_PRESENT_MASK Bit in compressed geometry data descriptor encoding presence of alphas.
write(CompressedGeometryData cg) Add a compressed geometry node component to the end of the instance.
The current object index becomes invalid; an immediately following call
to readNext() will return null.
Construct a new CompressedGeometryFile instance associated with the
specified file. An attempt is made to open the file with read-only
access; if this fails then a FileNotFoundException is thrown.
Parameters: file - path to the compressed geometry resource file exception: FileNotFoundException - if file doesn't exist orcannot be read exception: IllegalArgumentException - if the file is not a compressedgeometry resource file exception: IOException - if there is a header or directory read error
Construct a new CompressedGeometryFile instance associated with the
specified file.
Parameters: file - path to the compressed geometry resource file Parameters: rw - if true, opens the file for read and write access or attemptsto create one if it doesn't exist; if false, opens the file withread-only access exception: FileNotFoundException - if file doesn't exist oraccess permissions disallow access exception: IllegalArgumentException - if the file is not a compressedgeometry resource file exception: IOException - if there is a header or directory read error
Construct a new CompressedGeometryFile instance associated with a
currently open RandomAccessFile.
Parameters: file - currently open RandomAccessFile exception: IllegalArgumentException - if the file is not a compressedgeometry resource file exception: IOException - if there is a header or directory read error
Delete all compressed objects from this instance. This method may only
be called after successfully creating a CompressedGeometryFile instance
with read-write access, so a corrupted or otherwise invalid resource
must be removed manually before it can be rewritten. The close()
method must be called sometime after invoking clear() in order to write
out the new directory structure.
exception: IOException - if clear fails
Release the resources associated with this instance.
Write out final header and directory if contents were updated.
This method must be called in order to create a valid compressed
geometry resource file if any updates were made.
Return the current object index associated with this instance. This is
the index of the object that would be returned by an immediately
following call to the readNext() method. Its initial value is 0; -1
is returned if the last object has been read.
current object index, or -1 if at end
Return a string containing the file name associated with this instance
or null if there is none.
file name associated with this instance or null if there isnone
Read all compressed geometry objects contained in the instance. The
current object index becomes invalid; an immediately following call
to readNext() will return null.
an array of CompressedGeometryData node components. exception: IOException - if read fails
Read the compressed geometry object at the specified index. The
current object index is set to the subsequent object unless the last
object has been read, in which case the index becomes invalid and an
immediately following call to readNext() will return null.
Parameters: index - compressed geometry object to read a CompressedGeometryData node component exception: IndexOutOfBoundsException - if object index isout of range exception: IOException - if read fails
Read the next compressed geometry object in the instance. This is
initially the first object (index 0) in the instance; otherwise, it is
whatever object is next after the last one read. The current object
index is incremented by 1 after the read. When the last object is read
the index becomes invalid and an immediately subsequent call to
readNext() returns null.
a CompressedGeometryData node component, or null if the last objecthas been read exception: IOException - if read fails
Add a compressed geometry node component to the end of the instance.
The current object index becomes invalid; an immediately following call
to readNext() will return null. The close() method must be called at
some later time in order to create a valid compressed geometry file.
Parameters: cg - a compressed geometry node component exception: CapabilityNotSetException - if unable to get compressedgeometry data from the node component exception: IOException - if write fails
Add a buffer of compressed geometry data to the end of the
resource. The current object index becomes invalid; an immediately
following call to readNext() will return null. The close() method must
be called at some later time in order to create a valid compressed
geometry file.
Parameters: cgh - a CompressedGeometryData.Header object describing the data. Parameters: geometry - the compressed geometry data exception: IOException - if write fails