|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.blackbear.flatworm.FileParser
public class FileParser
Used to read a flatfile. Encapsulates parser setup and callback mechanism. This class wraps the functionality that used to be in the main() of the examples. This way, the client knows less about the internal workings of FlatWorm.
Constructor Summary | |
---|---|
FileParser(java.lang.String config,
java.lang.String file)
Constructor for FileParser |
Method Summary | |
---|---|
void |
close()
Close the input file |
void |
open()
Open the buffered reader for the input file |
void |
read()
Read the entire input file. |
void |
setBeanHandler(java.lang.String recordName,
java.lang.Object obj,
java.lang.String methodName)
Let's the parser know which object and method to call when a record has been successfully parsed and needs handling |
void |
setExceptionHandler(java.lang.Object obj,
java.lang.String methodName)
Let's the parser know which object and method to call when an exception occurs during record processing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileParser(java.lang.String config, java.lang.String file) throws FlatwormParserException
String
- full path to the FlatWorm XML configuration fileString
- full path to input file
FlatwormParserException
- - wraps FlatwormConfigurationValueException & FlatwormUnsetFieldValueException
(to reduce number of exceptions clients have to be aware of)Method Detail |
---|
public void setBeanHandler(java.lang.String recordName, java.lang.Object obj, java.lang.String methodName) throws java.lang.NoSuchMethodException
String
- recordname from your FlatWorm XML fileObject
- handler object which will responding to parse eventsString
- name of handler method from the handler class (passing this prevents java.reflection code in
client)
java.lang.NoSuchMethodException
- - This will most likely be caused by a oversight on your part (i.e. not yet
implemented this class in your handler or mispelled the method name when passing it to this method)public void setExceptionHandler(java.lang.Object obj, java.lang.String methodName) throws java.lang.NoSuchMethodException
String
- recordname from your FlatWorm XML fileObject
- handler object which will responding to parse eventsString
- name of handler method from the handler class (passing this prevents java.reflection code in
client)
java.lang.NoSuchMethodException
- - This will most likely be caused by a oversight on your part (i.e. not yet
implemented this class in your handler or mispelled the method name when passing it to this method)public void open() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- - If the file you supplied does not happen to exist.public void close() throws java.io.IOException
java.io.IOException
- - Should the filesystem choose to complain about closing an existing file opened for reading.public void read()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |