Class CompressedGeometryFile

java.lang.Object
com.sun.j3d.utils.compression.CompressedGeometryFile

public class CompressedGeometryFile extends Object
Deprecated.
As of Java 3D 1.5, replaced by com.sun.j3d.utils.geometry.compression.CompressedGeometryFile.
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.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Construct a new CompressedGeometryFile instance associated with a currently open RandomAccessFile.
    Deprecated.
    Construct a new CompressedGeometryFile instance associated with the specified file.
    CompressedGeometryFile(String file, boolean rw)
    Deprecated.
    Construct a new CompressedGeometryFile instance associated with the specified file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Delete all compressed objects from this instance.
    void
    Deprecated.
    Release the resources associated with this instance.
    protected void
    Deprecated.
    Release file resources when this object is garbage collected.
    int
    Deprecated.
    Return the current object index associated with this instance.
    Deprecated.
    Return a string containing the file name associated with this instance or null if there is none.
    int
    Deprecated.
    Return the major version number of the most recent compressor used to compress any of the objects in this instance.
    int
    Deprecated.
    Return the subminor version number of the most recent compressor used to compress any of the objects in this instance.
    int
    Deprecated.
    Return the minor version number of the most recent compressor used to compress any of the objects in this instance.
    int
    Deprecated.
    Return the number of compressed objects in this instance.
    Deprecated.
    Read all compressed geometry objects contained in the instance.
    read(int index)
    Deprecated.
    Read the compressed geometry object at the specified index.
    Deprecated.
    Read the next compressed geometry object in the instance.
    void
    Deprecated.
    Add a compressed geometry node component to the end of the instance.
    void
    write(CompressedGeometryHeader cgh, byte[] geometry)
    Deprecated.
    Add a buffer of compressed geometry data to the end of the resource.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CompressedGeometryFile

      public CompressedGeometryFile(String file) throws IOException
      Deprecated.
      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
      Throws:
      FileNotFoundException - if file doesn't exist or cannot be read
      IllegalArgumentException - if the file is not a compressed geometry resource file
      IOException - if there is a header or directory read error
    • CompressedGeometryFile

      public CompressedGeometryFile(String file, boolean rw) throws IOException
      Deprecated.
      Construct a new CompressedGeometryFile instance associated with the specified file.
      Parameters:
      file - path to the compressed geometry resource file
      rw - if true, opens the file for read and write access or attempts to create one if it doesn't exist; if false, opens the file with read-only access
      Throws:
      FileNotFoundException - if file doesn't exist or access permissions disallow access
      IllegalArgumentException - if the file is not a compressed geometry resource file
      IOException - if there is a header or directory read error
    • CompressedGeometryFile

      public CompressedGeometryFile(RandomAccessFile file) throws IOException
      Deprecated.
      Construct a new CompressedGeometryFile instance associated with a currently open RandomAccessFile.
      Parameters:
      file - currently open RandomAccessFile
      Throws:
      IllegalArgumentException - if the file is not a compressed geometry resource file
      IOException - if there is a header or directory read error
  • Method Details

    • clear

      public void clear() throws IOException
      Deprecated.
      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.
      Throws:
      IOException - if clear fails
    • getFileName

      public String getFileName()
      Deprecated.
      Return a string containing the file name associated with this instance or null if there is none.
      Returns:
      file name associated with this instance or null if there is none
    • getMajorVersionNumber

      public int getMajorVersionNumber()
      Deprecated.
      Return the major version number of the most recent compressor used to compress any of the objects in this instance.
      Returns:
      major version number
    • getMinorVersionNumber

      public int getMinorVersionNumber()
      Deprecated.
      Return the minor version number of the most recent compressor used to compress any of the objects in this instance.
      Returns:
      minor version number
    • getMinorMinorVersionNumber

      public int getMinorMinorVersionNumber()
      Deprecated.
      Return the subminor version number of the most recent compressor used to compress any of the objects in this instance.
      Returns:
      subminor version number
    • getObjectCount

      public int getObjectCount()
      Deprecated.
      Return the number of compressed objects in this instance.
      Returns:
      number of compressed objects
    • getCurrentIndex

      public int getCurrentIndex()
      Deprecated.
      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.
      Returns:
      current object index, or -1 if at end
    • readNext

      public CompressedGeometry readNext() throws IOException
      Deprecated.
      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.
      Returns:
      a CompressedGeometry node component, or null if the last object has been read
      Throws:
      IOException - if read fails
    • read

      public CompressedGeometry[] read() throws IOException
      Deprecated.
      Read all compressed geometry objects contained in the instance. The current object index becomes invalid; an immediately following call to readNext() will return null.
      Returns:
      an array of CompressedGeometry node components.
      Throws:
      IOException - if read fails
    • read

      public CompressedGeometry read(int index) throws IOException
      Deprecated.
      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
      Returns:
      a CompressedGeometry node component
      Throws:
      IndexOutOfBoundsException - if object index is out of range
      IOException - if read fails
    • write

      public void write(CompressedGeometry cg) throws IOException
      Deprecated.
      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
      Throws:
      CapabilityNotSetException - if unable to get compressed geometry data from the node component
      IOException - if write fails
    • write

      public void write(CompressedGeometryHeader cgh, byte[] geometry) throws IOException
      Deprecated.
      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 CompressedGeometryHeader object describing the data.
      geometry - the compressed geometry data
      Throws:
      IOException - if write fails
    • close

      public void close()
      Deprecated.
      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.
    • finalize

      protected void finalize()
      Deprecated.
      Release file resources when this object is garbage collected.
      Overrides:
      finalize in class Object