Class BeanWriterImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this output stream.
      void debug()
      Prints the internal view of the stream configuration to System.out
      void debug​(java.io.PrintStream out)
      Prints the internal view of the stream configuration.
      void flush()
      Flushes this output stream.
      void restoreState​(java.lang.String namespace, java.util.Map<java.lang.String,​java.lang.Object> state)
      Restores a Map of previously stored state information.
      void updateState​(java.lang.String namespace, java.util.Map<java.lang.String,​java.lang.Object> state)
      Updates a Map with the current state of the Writer to allow for restoration at a later time.
      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 class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • write

        public void write​(java.lang.Object bean)
                   throws BeanWriterException
        Description copied from interface: BeanWriter
        Writes a bean object to this output stream.
        Specified by:
        write in interface BeanWriter
        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) cases
        BeanWriterIOException - if the underlying output stream throws an IOException, or if this writer is closed
        InvalidBeanException - if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
      • write

        public void write​(java.lang.String recordName,
                          java.lang.Object bean)
                   throws BeanWriterException
        Description copied from interface: BeanWriter
        Writes a bean object to this output stream.
        Specified by:
        write in interface BeanWriter
        Parameters:
        recordName - the record or group name bound to the bean object from the mapping file
        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) cases
        BeanWriterIOException - if the underlying output stream throws an IOException, or if this writer is closed
        InvalidBeanException - if BeanIO is configured to validate fields during marshalling, and a field does not meet the configured validation rules
      • close

        public void close()
                   throws BeanWriterIOException
        Description copied from interface: BeanWriter
        Closes this output stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface BeanWriter
        Throws:
        BeanWriterIOException - if the underlying output stream throws an IOException, or if this writer is already closed
      • updateState

        public void updateState​(java.lang.String namespace,
                                java.util.Map<java.lang.String,​java.lang.Object> state)
        Description copied from interface: StatefulWriter
        Updates a Map with the current state of the Writer to allow for restoration at a later time.
        Specified by:
        updateState in interface StatefulWriter
        Parameters:
        namespace - a String to prefix all state keys with
        state - the Map to update with the latest state
      • restoreState

        public void restoreState​(java.lang.String namespace,
                                 java.util.Map<java.lang.String,​java.lang.Object> state)
                          throws java.lang.IllegalStateException
        Description copied from interface: StatefulWriter
        Restores a Map of previously stored state information.
        Specified by:
        restoreState in interface StatefulWriter
        Parameters:
        namespace - a String to prefix all state keys with
        state - the Map containing the state to restore
        Throws:
        java.lang.IllegalStateException - if the Map is missing any state information
      • debug

        public void debug()
        Description copied from interface: Debuggable
        Prints the internal view of the stream configuration to System.out
        Specified by:
        debug in interface Debuggable
      • debug

        public void debug​(java.io.PrintStream out)
        Description copied from interface: Debuggable
        Prints the internal view of the stream configuration.
        Specified by:
        debug in interface Debuggable
        Parameters:
        out - the PrintStream to write to