|
ST-Developer Java Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.steptools.stdev.p21.Part21Parser
public class Part21Parser
Provides the facilities to read a Part 21 file and populate a model from the instance data contained in the file. No state information is kept in the Part21Parser, so it is possible to use the same parser to read multiple files at the same time from different threads.
| Nested Class Summary | |
|---|---|
class |
Part21Parser.State
|
| Field Summary | |
|---|---|
boolean |
convert
If true, attempt to perform a type conversion before throwing an error. |
boolean |
fail_fast
If true, error recovery is disabled, and will result in an exception getting thrown on any errors in the Part 21 file. |
boolean |
keep_partial
If true, does not attempt to clean up when statusUpdate()
throws a CanceledException. |
int |
status_freq
Set the frequency at which the statusUpdate method is called. |
| Constructor Summary | |
|---|---|
Part21Parser()
Create a Part 21 file Reader. |
|
| Method Summary | |
|---|---|
SchemaBase |
getSchema(String name)
Find the schema for a given name. |
Model |
parse(File src)
Read a Part 21 file into a new Model. |
Model |
parse(File src,
String fname)
Read a Part 21 file into a new Model. |
void |
parse(File src,
String fname,
long flen,
Model mod,
EntityIDTable eids,
boolean set_header,
boolean one_sect)
Read a Part 21 file into an existing Model. |
Model |
parse(InputStream in,
String fname,
long flen)
Read a Part 21 file into a new Model. |
void |
parse(InputStream in,
String fname,
long flen,
Model mod,
EntityIDTable eids,
boolean set_header,
boolean one_sect)
Read a Part 21 file into an existing Model. |
Model |
parse(String fname)
Read a Part 21 file into a new Model. |
void |
reportError(String fname,
int lineno,
String message)
Report an error in the input file. |
void |
statusUpdate(Part21Parser.State st)
The method is called periodically as the parser parses its input. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public boolean fail_fast
public boolean convert
public int status_freq
status_freq instances
are read in.
public boolean keep_partial
statusUpdate()
throws a CanceledException. If this is false, the CanceledException will
be propogated to the called of parse(), and the partially
read model will be reclained by the garbage collector. If true the
incomplete model will be returned from the parse() method.
| Constructor Detail |
|---|
public Part21Parser()
throws STDevException
STDevException| Method Detail |
|---|
public SchemaBase getSchema(String name)
throws SchemaNotFoundException
name - The name of the schema as specified in Part 21
SchemaNotFoundException - the schema could not be found.
public void reportError(String fname,
int lineno,
String message)
fname - The Part21 file.lineno - The line number where the error occurred.message - The error message to be reported.
public void statusUpdate(Part21Parser.State st)
throws CanceledException
status_freq instance variable.
The read will be aborted if this method throws an exception.
st - The parser state information. This can be queried to
obtain the number of bytes in the file, the number of bytes ready by
the parser, and the number is insteances read.
CanceledException - to signal the parser to stop parsing the
file. If the exception's keepPartial() flag is
true, then the partially read model is return from the
parse method. Otherwise, the exception is propogated, and
the data that was read will be reclained by the garabge collecto.r
public Model parse(String fname)
throws STDevException,
IOException
fname - The file name.
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
public Model parse(File src)
throws STDevException,
IOException
src - The file to read.
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
public Model parse(File src,
String fname)
throws STDevException,
IOException
src - The file to read.fname - The file name for error reporting purposes.
If null, src.toString() will be used.
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
public Model parse(InputStream in,
String fname,
long flen)
throws STDevException,
IOException
in - The reader to readfname - The file name for error reporting purposes.flen - The length of the input stream in bytes. This is used for
status reporting.
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
public void parse(File src,
String fname,
long flen,
Model mod,
EntityIDTable eids,
boolean set_header,
boolean one_sect)
throws STDevException,
IOException
src - The Part 21 file to readfname - The file name for error reporting purposes.flen - The length of the input stream in bytes. This is used for
status reporting.mod - The model to populateeids - The entity ID table to populateset_header - Add the file header as a section to the model.one_sect - Force everything into one data population
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
public void parse(InputStream in,
String fname,
long flen,
Model mod,
EntityIDTable eids,
boolean set_header,
boolean one_sect)
throws STDevException,
IOException
in - The reader to readfname - The file name for error reporting purposes.flen - The length of the input stream in bytes. This is used for
status reporting.mod - The model to populateeids - The entity ID table to populateset_header - Add the file header as a section to the model.one_sect - Force everything into one data population
STDevException - There was some problem parsing the file
IOException - An I/O exception occurred getting the input
|
ST-Developer Java Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||