j3d.org Code

org.j3d.loaders.c3d
Class C3DParser

java.lang.Object
  extended by org.j3d.loaders.c3d.C3DParser

public class C3DParser
extends java.lang.Object

A low-level parser for the C3D file format.

The output of this parser is the parameter block and streams of data expressed as Java float arrays.

The definition of the file format can be found at: http://www.c3d.org/

Version:
$Revision: 1.4 $
Author:
Justin Couch

Constructor Summary
C3DParser()
          Construct a new parser with no stream set.
C3DParser(java.io.InputStream is)
          Construct a new parser using the given stream to source the data from.
 
Method Summary
 void clear()
          Force a clear of the data that has been previous read by this parser.
 C3DAnalogData[] getAnalogSamples()
          Get the last parsed set of analog samples.
 C3DHeader getHeader()
          Get the last parsed file header information.
 C3DParameterGroup[] getParameters()
          Get the last parsed set of parameter groups.
 C3DTrajectoryData[] getTrajectories()
          Get the last parsed set of trajectories.
 void parse(boolean retainData)
          Parse the stream now and start generating the output.
 void reset(java.io.InputStream is)
          Reset the parser to use the new stream.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the parsing internals can be reported in a nice, pretty fashion.
 void setParseObserver(C3DParseObserver obs)
          Set the observer for parsing events that can be used with this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

C3DParser

public C3DParser()
Construct a new parser with no stream set.


C3DParser

public C3DParser(java.io.InputStream is)
Construct a new parser using the given stream to source the data from.

Parameters:
is - The stream to read data from
Method Detail

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the parsing internals can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Parameters:
reporter - The instance to use or null

setParseObserver

public void setParseObserver(C3DParseObserver obs)
Set the observer for parsing events that can be used with this class. Only a single instance may be set at any time, so calling this will replace the currently registered instance. If called with a null value, it removes the currently set instance.

Parameters:
obs - The observer instance to use

getHeader

public C3DHeader getHeader()
Get the last parsed file header information. If this parser has been cleared or the user requested that data not be retained, this will return null.

Returns:
The header of the last-read stream or null

getParameters

public C3DParameterGroup[] getParameters()
Get the last parsed set of parameter groups. If this parser has been cleared or the user requested that data not be retained, this will return null. Otherwise, the array will contain the exact number of parameter groups read.

Returns:
The set of groups from the last-read stream, or null

getTrajectories

public C3DTrajectoryData[] getTrajectories()
Get the last parsed set of trajectories. If this parser has been cleared or the user requested that data not be retained, this will return null. Otherwise, the array will contain the exact number of trajectories read.

Returns:
The set of trajectories from the last-read stream, or null

getAnalogSamples

public C3DAnalogData[] getAnalogSamples()
Get the last parsed set of analog samples. If this parser has been cleared or the user requested that data not be retained, this will return null. Otherwise, the array will contain the exact number of trajectories read.

Returns:
The set of samples from the last-read stream, or null

clear

public void clear()
Force a clear of the data that has been previous read by this parser.


reset

public void reset(java.io.InputStream is)
Reset the parser to use the new stream. After calling this method all header and height information is reset to empty.

Parameters:
is - The new stream to use

parse

public void parse(boolean retainData)
           throws java.io.IOException
Parse the stream now and start generating the output. This will automatically have the first parameter block queued in the reader because we need it to know which file format type is to be processed.

Parameters:
retainData - true if the parser should maintain a copy of all the data read locally
Throws:
java.io.IOException - some problem reading the basic file.

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org