T
- the type of data model to parse intopublic interface Parser<T>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ENCODING
The default encoding of the files being parsed.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorItemListener(ErrorItemListener listener)
Register an
ErrorItemListener with this parser. |
void |
addProgressListener(ProgressListener listener)
Register a
ProgressListener with this parser. |
String |
getEncoding()
Gets current encoding for the parser.
|
Collection<ErrorItemListener> |
getErrorItemListeners()
Get the collection of
ErrorItemListener s registered to this
parser |
Collection<ProgressListener> |
getProgressListeners()
Get the collection of
ProgressListener s that are currently registered to this parser. |
T |
parse(InputStream dataIn)
Perform parsing from the supplied input stream to a new data model instance.
|
T |
parse(InputStream dataIn,
T target)
Perform parsing from the supplied input stream to a new data model instance.
|
T |
parse(InputStream dataIn,
T target,
ExecutorService service)
Perform parsing from the supplied input stream to a new data model instance, delegating all work to the supplied
Executor Service to enable parsing in parallel.
|
void |
removeErrorItemListener(ErrorItemListener listener)
Deregister an
ErrorItemListener with this parser. |
void |
removeProgressListener(ProgressListener listener)
Deregister a
ProgressListener from this parser. |
void |
setEncoding(String encoding)
Sets an alternative encoding for the parser.
|
static final String DEFAULT_ENCODING
ReadHandler
s are available. Validate
operations are triggered if this parser has a validator set and if ValidateHandler
s
are available, and convert operations are triggered if this parser has an output resource set and if ConversionHandler
s are available. Read operations are always performed
first, followed by validate operations, followed finally by convert operations.String getEncoding()
void setEncoding(String encoding)
encoding
- input encoding of the streamvoid addErrorItemListener(ErrorItemListener listener)
ErrorItemListener
with this parser. Whenever an error is encountered when parsing from the a
parserSource, this listener should be notified.listener
- the listener to registervoid removeErrorItemListener(ErrorItemListener listener)
ErrorItemListener
with this parser. This listener will no longer be notified when error
items are generated.listener
- the listener to registerCollection<ErrorItemListener> getErrorItemListeners()
ErrorItemListener
s registered to this
parservoid addProgressListener(ProgressListener listener)
ProgressListener
with this parser. Whenever the parser has more progress to report, this
listener will be notified.listener
- the listener to registervoid removeProgressListener(ProgressListener listener)
ProgressListener
from this parser. Progress events will no longer be reported through this
parserlistener
- a listener to monitor progress of the parsing operationCollection<ProgressListener> getProgressListeners()
ProgressListener
s that are currently registered to this parser.T parse(InputStream dataIn) throws ParseException
dataIn
- the input stream to parse fromParseException
- if the source format was invalid, or the URL could not be read.T parse(InputStream dataIn, T target) throws ParseException
dataIn
- the input stream to parse fromtarget
- the data model to populate with data during this parse operationParseException
- if the source format was invalid, or the URL could not be read.T parse(InputStream dataIn, T target, ExecutorService service) throws ParseException, InterruptedException
dataIn
- the input stream to parse fromtarget
- the data model to populate with data during this parse operationservice
- the service to use to execute parsing tasksParseException
- if the source format was invalid, or the URL could not be read.InterruptedException
- if execution of a task sent to the Executor Service was interrruptedCopyright © 2014. All rights reserved.