Package org.beanio.stream
Interface RecordParserFactory
-
- All Known Implementing Classes:
CsvRecordParserFactory
,DelimitedRecordParserFactory
,FixedLengthRecordParserFactory
,JsonRecordParserFactory
,RecordParserFactorySupport
,XmlRecordParserFactory
public interface RecordParserFactory
Factory interface for creating record parsers.The Java object bound to a record depends on the stream format. The following table shows the object used for each format:
Format Record Type Fixed Length String
CSV, Delimited String[]
XML Document
The following table shows the method invoked for a requested BeanIO interface.
Requests For Invokes BeanReader
createReader(Reader)
BeanWriter
createWriter(Writer)
Unmarshaller
createUnmarshaller()
Marshaller
createMarshaller()
A
RecordParserFactory
implementation must be thread safe (after all of its properties have been set).- Since:
- 2.0
- See Also:
RecordReader
,RecordWriter
,RecordMarshaller
,RecordUnmarshaller
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RecordMarshaller
createMarshaller()
Creates a parser for marshalling records.RecordReader
createReader(java.io.Reader in)
Creates a parser for reading records from an input stream.RecordUnmarshaller
createUnmarshaller()
Creates a parser for unmarshalling records.RecordWriter
createWriter(java.io.Writer out)
Creates a parser for writing records to an output stream.void
init()
Initializes the factory.
-
-
-
Method Detail
-
init
void init() throws java.lang.IllegalArgumentException
Initializes the factory. This method is called when a mapping file is loaded after all parser properties have been set, and is therefore ideally used to preemptively validate parser configuration settings.- Throws:
java.lang.IllegalArgumentException
- if the parser configuration is invalid
-
createReader
RecordReader createReader(java.io.Reader in) throws java.lang.IllegalArgumentException
Creates a parser for reading records from an input stream.- Parameters:
in
- the input stream to read from- Returns:
- the created
RecordReader
- Throws:
java.lang.IllegalArgumentException
- if this factory is improperly configured and aRecordReader
cannot be created
-
createWriter
RecordWriter createWriter(java.io.Writer out) throws java.lang.IllegalArgumentException
Creates a parser for writing records to an output stream.- Parameters:
out
- the output stream to write to- Returns:
- the new
RecordWriter
- Throws:
java.lang.IllegalArgumentException
- if this factory is improperly configured and aRecordWriter
cannot be created
-
createMarshaller
RecordMarshaller createMarshaller() throws java.lang.IllegalArgumentException
Creates a parser for marshalling records.- Returns:
- the created
RecordMarshaller
- Throws:
java.lang.IllegalArgumentException
- if this factory is improperly configured and aRecordMarshaller
cannot be created
-
createUnmarshaller
RecordUnmarshaller createUnmarshaller() throws java.lang.IllegalArgumentException
Creates a parser for unmarshalling records.- Returns:
- the created
RecordUnmarshaller
- Throws:
java.lang.IllegalArgumentException
- if this factory is improperly configured and aRecordUnmarshaller
cannot be created
-
-