Class DebugWriter


public class DebugWriter extends ProxyWriter
A proxy that prints records passing through to a stream in a human-readable format
  • Constructor Details

    • DebugWriter

      public DebugWriter(DataWriter nestedDataWriter, String id, Writer writer)
      Creates a writer that prints each record to writer under a header showing id and the record count.
    • DebugWriter

      public DebugWriter(DataWriter nestedDataWriter, String id, OutputStream outputStream)
      Creates a writer that prints each record to outputStream under a header showing id and the record count.
    • DebugWriter

      public DebugWriter(DataWriter nestedDataWriter, String id)
      Creates a writer that prints each record to System.out under a header showing id and the record count.
    • DebugWriter

      public DebugWriter(DataWriter nestedDataWriter)
      Creates a writer that prints each record to System.out under a header showing the id debug and the record count.
  • Method Details

    • 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
    • getCloseWriterOnClose

      public boolean getCloseWriterOnClose()
      Indicates if the debug output is closed when this writer is closed (default is false).
    • setCloseWriterOnClose

      public void setCloseWriterOnClose(boolean closeWriterOnClose)
      Indicates if the debug output is closed when this writer is closed (default is false).
    • getIncludeElapsedTime

      public boolean getIncludeElapsedTime()
      Indicates if each record's header also shows how long this writer has been open (default is false).
    • setIncludeElapsedTime

      public DebugWriter setIncludeElapsedTime(boolean includeElapsedTime)
      Indicates if each record's header also shows how long this writer has been open (default is false).
    • interceptRecord

      protected Record interceptRecord(Record record) throws Throwable
      Description copied from class: ProxyWriter
      Overridden by subclasses to transform, drop, or observe a record on its way through this proxy.

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

      • Return the record (possibly modified) to forward it to the nested DataWriter.
      • Return null to drop the record; the framework will not write it downstream.
      • Throw to fail the pipeline; the framework wraps the throwable in a DataException with .setRecord(record).
      • The nested DataWriter is opened and closed for you; do not write to it here.
      • Do not call DataEndpoint.incrementRecordCount() here.
      Overrides:
      interceptRecord in class ProxyWriter
      Throws:
      Throwable