| java.lang.Object com.sun.j3d.utils.geometry.compression.CompressedGeometryData
CompressedGeometryData | public class CompressedGeometryData extends Object (Code) | | The compressed geometry object is used to store geometry in a
compressed format. Using compressed geometry may increase the speed
objects can be sent over the network. Note that the geometry will
be decompressed in memory, so the application will not see any
memory savings.
Compressed geometry may be passed to this CompressedGeometryData object
in one of two ways: by copying the data into this object using the
existing constructor, or by passing a reference to the data.
-
By Copying:
In by-copy mode, the CompressedGeometryData constructor copies the buffer of
compressed geometry data into this CompressedGeometryData object. This
is appropriate for many applications, and allows Java 3D to verify
the data once and then not worry about it again.
- By Reference:
In by-reference mode, the
compressed geometry data is accessed by reference, directly from
the user's array. To use this feature, you need to construct a
CompressedGeometryData object with the
byReference flag
set to true . In this mode, a reference to the input
data is saved, but the data itself is not necessarily copied. Note
that the compressed geometry header is still copied into this
compressed geometry object. Data referenced by a
CompressedGeometryData object must not be modified after the
CompressedGeometryData object is constructed.
Applications
must exercise care not to violate this rule. If any referenced
compressed geometry data is modified after construction,
the results are undefined.
since: Java 3D 1.5 |
Inner Class :public static class Header extends Object | |
Constructor Summary | |
public | CompressedGeometryData(Header hdr, byte[] compressedGeometry) Creates a new CompressedGeometryData object by copying
the specified compressed geometry data into this object.
If the version number of compressed geometry, as specified by
the Header, is incompatible with the
supported version of compressed geometry, then an exception
will be thrown.
Parameters: hdr - the compressed geometry header. | public | CompressedGeometryData(Header hdr, byte[] compressedGeometry, boolean byReference) Creates a new CompressedGeometryData object. | public | CompressedGeometryData(Header hdr, J3DBuffer compressedGeometry) Creates a new CompressedGeometryData object. |
Method Summary | |
public Shape3D[] | decompress() Decompresses the compressed geometry. | public int | getByteCount() Returns the size, in bytes, of the compressed geometry buffer. | public void | getCompressedGeometry(byte[] compressedGeometry) Retrieves the compressed geometry associated with the
CompressedGeometryData object. | public J3DBuffer | getCompressedGeometryBuffer() Gets the compressed geometry data buffer reference, which is
always null since NIO buffers are not supported for
CompressedGeometryData objects. | public void | getCompressedGeometryHeader(Header hdr) Copies the compressed geometry header from the CompressedGeometryData
object into the passed in parameter. | public byte[] | getCompressedGeometryRef() Gets the compressed geometry data reference. | public boolean | isByReference() Retrieves the data access mode for this CompressedGeometryData object. |
CompressedGeometryData | public CompressedGeometryData(Header hdr, byte[] compressedGeometry)(Code) | | Creates a new CompressedGeometryData object by copying
the specified compressed geometry data into this object.
If the version number of compressed geometry, as specified by
the Header, is incompatible with the
supported version of compressed geometry, then an exception
will be thrown.
Parameters: hdr - the compressed geometry header. This is copiedinto this CompressedGeometryData object. Parameters: compressedGeometry - the compressed geometry data. Thegeometry must conform to the format described in Appendix B ofthe Java 3D API Specification. exception: IllegalArgumentException - if a problem is detected with theheader. |
CompressedGeometryData | public CompressedGeometryData(Header hdr, byte[] compressedGeometry, boolean byReference)(Code) | | Creates a new CompressedGeometryData object. The
specified compressed geometry data is either copied into this
object or is accessed by reference.
If the version number of compressed geometry, as specified by
the Header, is incompatible with the
supported version of compressed geometry, then an exception
will be thrown.
Parameters: hdr - the compressed geometry header. This is copiedinto the CompressedGeometryData object. Parameters: compressedGeometry - the compressed geometry data. Thegeometry must conform to the format described in Appendix B ofthe Java 3D API Specification. Parameters: byReference - a flag that indicates whether the data is copiedinto this compressed geometry object or is accessed by reference. exception: IllegalArgumentException - if a problem is detected with theheader. |
CompressedGeometryData | public CompressedGeometryData(Header hdr, J3DBuffer compressedGeometry)(Code) | | Creates a new CompressedGeometryData object. The
specified compressed geometry data is accessed by reference
from the specified buffer.
If the version number of compressed geometry, as specified by
the Header, is incompatible with the
supported version of compressed geometry, then an exception
will be thrown.
Parameters: hdr - the compressed geometry header. This is copiedinto the CompressedGeometryData object. Parameters: compressedGeometry - a buffer containing an NIO byte bufferof compressed geometry data. Thegeometry must conform to the format described in Appendix B ofthe Java 3D API Specification. exception: UnsupportedOperationException - this method is notyet implemented exception: IllegalArgumentException - if a problem is detected with theheader,or if the java.nio.Buffer contained in the specified J3DBufferis not a java.nio.ByteBuffer object. See Also: Header |
decompress | public Shape3D[] decompress()(Code) | | Decompresses the compressed geometry. Returns an array of Shape nodes
containing the decompressed geometry objects, or null if the version
number of the compressed geometry is incompatible with the decompressor
in the current version of Java 3D.
an array of Shape nodes containing thegeometry decompressed from this CompressedGeometryDataobject, or null if its version is incompatible |
getByteCount | public int getByteCount()(Code) | | Returns the size, in bytes, of the compressed geometry buffer.
The size of the compressed geometry header is not included.
the size, in bytes, of the compressed geometry buffer. |
getCompressedGeometry | public void getCompressedGeometry(byte[] compressedGeometry)(Code) | | Retrieves the compressed geometry associated with the
CompressedGeometryData object. Copies the compressed
geometry from the CompressedGeometryData node into the given array.
The array must be large enough to hold all of the bytes.
The individual array elements must be allocated by the caller.
Parameters: compressedGeometry - the array into which to copy the compressedgeometry. exception: IllegalStateException - if the data access mode for thisobject is by-reference. exception: ArrayIndexOutOfBoundsException - if compressedGeometry bytearray is not large enough to receive the compressed geometry |
getCompressedGeometryBuffer | public J3DBuffer getCompressedGeometryBuffer()(Code) | | Gets the compressed geometry data buffer reference, which is
always null since NIO buffers are not supported for
CompressedGeometryData objects.
null |
getCompressedGeometryHeader | public void getCompressedGeometryHeader(Header hdr)(Code) | | Copies the compressed geometry header from the CompressedGeometryData
object into the passed in parameter.
Parameters: hdr - the Header object into which to copy theCompressedGeometryData object's header; the offset field may differfrom that which was originally specified if a copy of the originalcompressed geometry byte array was created. |
getCompressedGeometryRef | public byte[] getCompressedGeometryRef()(Code) | | Gets the compressed geometry data reference.
the current compressed geometry data reference. exception: IllegalStateException - if the data access mode for thisobject is not by-reference. |
isByReference | public boolean isByReference()(Code) | | Retrieves the data access mode for this CompressedGeometryData object.
true if the data access mode for thisCompressedGeometryData object is by-reference;false if the data access mode is by-copying. |
|
|