|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.StreamFactory org.beanio.parser.DefaultStreamFactory
public class DefaultStreamFactory
The DefaultStreamFactory stores configured stream definitions used to create bean readers and writers. The factory is thread safe and the same stream definition can be used to concurrently read and write multiple streams.
Constructor Summary | |
---|---|
DefaultStreamFactory()
Constructs a new DefaultStreamFactory. |
Method Summary | |
---|---|
void |
addStream(StreamDefinition context)
Adds a stream context to this manager. |
BeanReader |
createReader(String name,
Reader in,
Locale locale)
Creates a new BeanReader for reading from a stream. |
BeanWriter |
createWriter(String name,
Writer out)
Creates a new BeanWriter for writing to a stream. |
protected StreamDefinition |
getStream(String name)
Returns the named stream. |
boolean |
isMapped(String streamName)
Test whether a mapping configuration exists for a named stream. |
void |
load(InputStream in)
Loads a BeanIO configuration and adds the configured streams to this factory. |
StreamDefinition |
removeStream(String name)
Removes the named stream from this manager. |
void |
setConfigurationFactory(ConfigurationFactory configurationFactory)
Sets the configuration factory to use to load stream definitions. |
protected void |
validateStreamName(String name)
Validates a stream name. |
Methods inherited from class org.beanio.StreamFactory |
---|
createReader, createReader, createReader, createWriter, load, load, loadResource, newInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultStreamFactory()
Method Detail |
---|
public void load(InputStream in) throws IOException, BeanIOConfigurationException
StreamFactory
load
in class StreamFactory
in
- the input stream to read the configuration from
BeanIOConfigurationException
- if the configuration is invalid
IOException
public BeanReader createReader(String name, Reader in, Locale locale)
StreamFactory
createReader
in class StreamFactory
name
- the configured stream mapping namein
- the input stream to read fromlocale
- the locale used to format error messages, or if null,
Locale.getDefault()
is used
public BeanWriter createWriter(String name, Writer out)
StreamFactory
createWriter
in class StreamFactory
name
- the configured stream mapping nameout
- the output stream to write to
protected StreamDefinition getStream(String name) throws IllegalArgumentException
name
- the name of the stream
IllegalArgumentException
- if there is no stream configured for the given namepublic void addStream(StreamDefinition context)
context
- the stream context to addpublic StreamDefinition removeStream(String name)
name
- the name of the stream to remove
public void setConfigurationFactory(ConfigurationFactory configurationFactory)
configurationFactory
- the configuration factoryprotected void validateStreamName(String name) throws IllegalArgumentException
StreamFactory
validateStreamName
in class StreamFactory
name
- the stream name to validate
IllegalArgumentException
- if there is no stream configured with this namepublic boolean isMapped(String streamName)
StreamFactory
isMapped
in class StreamFactory
streamName
- the stream name to test for existence
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |