Class DebugReader


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

    • DebugReader

      public DebugReader(DataReader nestedDataReader, String id, Writer writer)
      Creates a reader that prints each record to writer under a header showing id and the record count.
    • DebugReader

      public DebugReader(DataReader nestedDataReader, String id, OutputStream outputStream)
      Creates a reader that prints each record to outputStream under a header showing id and the record count.
    • DebugReader

      public DebugReader(DataReader nestedDataReader, String id)
      Creates a reader that prints each record to System.out under a header showing id and the record count.
    • DebugReader

      public DebugReader(DataReader nestedDataReader)
      Creates a reader 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 ProxyReader
      Throws:
      DataException
    • getCloseWriterOnClose

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

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

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

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

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

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

      • Return the record (possibly modified) to pass it downstream.
      • Return null to drop the record; the framework reads the next one.
      • Throw to fail the pipeline; the framework wraps the throwable in a DataException with .setRecord(record).
      • The nested DataReader is opened and closed for you; do not read from it here.
      • Do not call DataEndpoint.incrementRecordCount() here.
      Overrides:
      interceptRecord in class ProxyReader
      Throws:
      Throwable