Package org.beanio
Interface BeanWriter
-
- All Superinterfaces:
java.lang.AutoCloseable
,Debuggable
- All Known Implementing Classes:
BeanWriterImpl
public interface BeanWriter extends Debuggable, java.lang.AutoCloseable
Interface for marshalling bean objects to an output stream.A
BeanWriter
is created using aStreamFactory
and a mapping file.- Since:
- 1.0
- See Also:
StreamFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes this output stream.void
flush()
Flushes this output stream.void
write(java.lang.Object bean)
Writes a bean object to this output stream.void
write(java.lang.String recordName, java.lang.Object bean)
Writes a bean object to this output stream.-
Methods inherited from interface org.beanio.internal.util.Debuggable
debug, debug
-
-
-
-
Method Detail
-
write
void write(java.lang.Object bean) throws BeanWriterException, BeanWriterIOException
Writes a bean object to this output stream.- Parameters:
bean
- the bean object to write- Throws:
BeanWriterException
- if a record could not be identified for marshalling, or in a few other rare (but fatal) casesBeanWriterIOException
- if the underlying output stream throws anIOException
, or if this writer is closedInvalidBeanException
- if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
-
write
void write(java.lang.String recordName, java.lang.Object bean) throws BeanWriterException
Writes a bean object to this output stream.- Parameters:
recordName
- the record or group name bound to the bean object from the mapping filebean
- the bean object to write- Throws:
BeanWriterException
- if a record could not be identified for marshalling, or in a few other rare (but fatal) casesBeanWriterIOException
- if the underlying output stream throws anIOException
, or if this writer is closedInvalidBeanException
- if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
-
flush
void flush() throws BeanWriterIOException
Flushes this output stream.- Throws:
BeanWriterIOException
- if the underlying output stream throws anIOException
, or if this writer is closed
-
close
void close() throws BeanWriterIOException
Closes this output stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
BeanWriterIOException
- if the underlying output stream throws anIOException
, or if this writer is already closed
-
-