|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.StreamFactory org.beanio.internal.DefaultStreamFactory
public class DefaultStreamFactory
The DefaultStreamFactory stores configured stream definitions used to create bean readers and writers. A single factory instance may be accessed concurrently by multiple threads.
Constructor Summary | |
---|---|
DefaultStreamFactory()
Constructs a new DefaultStreamFactory. |
Method Summary | |
---|---|
void |
addStream(Stream stream)
Adds a stream to this manager. |
Marshaller |
createMarshaller(String name)
Creates a new Marshaller for marshalling bean objects. |
BeanReader |
createReader(String name,
Reader in,
Locale locale)
Creates a new BeanReader for reading from a stream. |
Unmarshaller |
createUnmarshaller(String name,
Locale locale)
Creates a new Unmarshaller for unmarshalling records. |
BeanWriter |
createWriter(String name,
Writer out)
Creates a new BeanWriter for writing to a stream. |
protected Stream |
getStream(String name)
Returns the named stream. |
protected void |
init()
This method is invoked after a StreamFactory is loaded and all attributes have been set. |
boolean |
isMapped(String streamName)
Test whether a mapping configuration exists for a named stream. |
void |
load(InputStream in,
Properties properties)
Loads a BeanIO mapping file, and adds the configured streams to this factory. |
Stream |
removeStream(String name)
Removes the named stream from this manager. |
void |
setCompiler(StreamCompiler compiler)
Sets the mapping compiler to use for compiling streams. |
Methods inherited from class org.beanio.StreamFactory |
---|
createReader, createReader, createReader, createUnmarshaller, createWriter, getClassLoader, load, load, load, load, load, loadResource, loadResource, newInstance, newInstance, setClassLoader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultStreamFactory()
Method Detail |
---|
protected void init()
StreamFactory
init
in class StreamFactory
public void load(InputStream in, Properties properties) throws IOException, BeanIOConfigurationException
StreamFactory
load
in class StreamFactory
in
- the input stream to read the mapping file fromproperties
- user Properties
for property substitution
BeanIOConfigurationException
- if the mapping file is invalid
IOException
public BeanReader createReader(String name, Reader in, Locale locale)
StreamFactory
createReader
in class StreamFactory
name
- the name of the stream in the mapping filein
- the input stream to read fromlocale
- the Locale
used to format error messages, or null to use Locale.getDefault()
BeanReader
public Unmarshaller createUnmarshaller(String name, Locale locale)
StreamFactory
Unmarshaller
for unmarshalling records.
createUnmarshaller
in class StreamFactory
name
- the name of the stream in the mapping filelocale
- the Locale
used to format error messages, or null to use Locale.getDefault()
Unmarshaller
public BeanWriter createWriter(String name, Writer out)
StreamFactory
createWriter
in class StreamFactory
name
- the name of the stream in the mapping fileout
- the output stream to write to
BeanWriter
public Marshaller createMarshaller(String name)
StreamFactory
Marshaller
for marshalling bean objects.
createMarshaller
in class StreamFactory
name
- the name of the stream in the mapping file
Marshaller
protected Stream getStream(String name) throws IllegalArgumentException
name
- the name of the stream
Stream
IllegalArgumentException
- if there is no stream configured for the given namepublic void addStream(Stream stream)
stream
- the Stream
to addpublic Stream removeStream(String name)
name
- the name of the stream to remove
Stream
, or null if
the there was no stream for the given namepublic void setCompiler(StreamCompiler compiler)
compiler
- the StreamCompiler
public boolean isMapped(String streamName)
StreamFactory
isMapped
in class StreamFactory
streamName
- the stream name to test for existence
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |