Class SequenceWriter


public class SequenceWriter extends ProxyWriter
Writes to sequence of data writers created by a factory in turn and rolled based on a ISequenceStrategy policy. Each writer is closed when the ISequenceStrategy indicates it sholud end and a new one is created by the factory.
  • Constructor Details

  • Method Details

    • getStrategy

      public SequenceWriter.ISequenceStrategy getStrategy()
    • getFactory

      public SequenceWriter.DataWriterFactory getFactory()
    • getSequencesStarted

      public long getSequencesStarted()
      Returns the number of sequences (nested writers) created so far.
    • getSequencesFinished

      public long getSequencesFinished()
      Returns the number of sequences that have ended, including the last one once this writer is closed.
    • getSequenceCount

      @Deprecated public long getSequenceCount()
      Deprecated.
      use getSequencesStarted() instead The number of sequences created by this writer (alias for getSequencesStarted()).
    • getCurrentSequence

      public SequenceWriter.Sequence getCurrentSequence()
      Returns the current Sequence in use by this writer, null if it hasn't started writing, or the last sequence if it has finished writing.
    • writeImpl

      protected void writeImpl(Record record) throws Throwable
      Description copied from class: DataWriter
      Overridden by subclasses to write the specified record to this DataWriter.

      Contract for subclasses (see also docs/authoring/DataWriter.md):

      Overrides:
      writeImpl in class ProxyWriter
      Throws:
      Throwable
    • beforeSequenceCreated

      protected void beforeSequenceCreated()
      Called before the factory creates the writer for a new sequence; does nothing by default.
    • afterSequenceCreated

      protected void afterSequenceCreated()
      Called once a new sequence's writer has been created and opened; does nothing by default.
    • afterSequenceFinished

      protected void afterSequenceFinished()
      Called when a sequence ends -- after the next sequence's writer is created, or when this writer is closed; does nothing by default.
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class ProxyWriter
      Throws:
      DataException
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class ProxyWriter