public class DefaultStreamFactory extends StreamFactory
| Constructor and Description |
|---|
DefaultStreamFactory()
Constructs a new DefaultStreamFactory.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
define(StreamBuilder builder)
Defines a new stream mapping.
|
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.
|
createReader, createReader, createReader, createUnmarshaller, createWriter, getClassLoader, load, load, load, load, load, loadResource, loadResource, newInstance, newInstance, setClassLoaderpublic DefaultStreamFactory()
protected void init()
StreamFactoryinit in class StreamFactorypublic void define(StreamBuilder builder)
StreamFactorydefine in class StreamFactorybuilder - the StreamBuilderpublic void load(InputStream in, Properties properties) throws IOException, BeanIOConfigurationException
StreamFactoryload in class StreamFactoryin - the input stream to read the mapping file fromproperties - user Properties for property substitutionBeanIOConfigurationException - if the mapping file is invalidIOExceptionpublic BeanReader createReader(String name, Reader in, Locale locale)
StreamFactorycreateReader in class StreamFactoryname - 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()BeanReaderpublic Unmarshaller createUnmarshaller(String name, Locale locale)
StreamFactoryUnmarshaller for unmarshalling records.createUnmarshaller in class StreamFactoryname - the name of the stream in the mapping filelocale - the Locale used to format error messages, or null to use Locale.getDefault()Unmarshallerpublic BeanWriter createWriter(String name, Writer out)
StreamFactorycreateWriter in class StreamFactoryname - the name of the stream in the mapping fileout - the output stream to write toBeanWriterpublic Marshaller createMarshaller(String name)
StreamFactoryMarshaller for marshalling bean objects.createMarshaller in class StreamFactoryname - the name of the stream in the mapping fileMarshallerprotected Stream getStream(String name) throws IllegalArgumentException
name - the name of the streamStreamIllegalArgumentException - 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 removeStream, or null if
the there was no stream for the given namepublic void setCompiler(StreamCompiler compiler)
compiler - the StreamCompilerpublic boolean isMapped(String streamName)
StreamFactoryisMapped in class StreamFactorystreamName - the stream name to test for existence