Class IoLogger<T>

java.lang.Object
org.refcodes.logger.alt.io.IoLogger<T>
Type Parameters:
T - The type of the Record instances managed by the Logger.
All Implemented Interfaces:
org.refcodes.logger.LogDecorator, org.refcodes.logger.Logger<T>, org.refcodes.mixin.DelimiterAccessor, org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<IoLogger<T>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty, org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator, org.refcodes.mixin.PrintStreamAccessor.PrintStreamMutator, org.refcodes.mixin.TrimAccessor, org.refcodes.mixin.TrimAccessor.TrimBuilder<IoLogger<T>>, org.refcodes.mixin.TrimAccessor.TrimMutator, org.refcodes.mixin.TrimAccessor.TrimProperty, org.refcodes.textual.CsvEscapeModeAccessor, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<IoLogger<T>>, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty

public class IoLogger<T> extends Object implements org.refcodes.logger.Logger<T>, org.refcodes.mixin.PrintStreamAccessor.PrintStreamMutator, org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<IoLogger<T>>, org.refcodes.mixin.TrimAccessor.TrimProperty, org.refcodes.mixin.TrimAccessor.TrimBuilder<IoLogger<T>>, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty, org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<IoLogger<T>>
The IoLogger implements the Logger interface for providing logging functionality for I/O output (e.g. via System.out and System.err by default).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.textual.CsvEscapeModeAccessor

    org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<B extends org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<?>>, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty

    Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor

    org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty

    Nested classes/interfaces inherited from interface org.refcodes.mixin.TrimAccessor

    org.refcodes.mixin.TrimAccessor.TrimBuilder<B extends org.refcodes.mixin.TrimAccessor.TrimBuilder<B>>, org.refcodes.mixin.TrimAccessor.TrimMutator, org.refcodes.mixin.TrimAccessor.TrimProperty
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.refcodes.textual.CsvBuilder
     
    protected PrintStream
     
    protected org.refcodes.tabular.Header<T>
     
    protected PrintStream
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a IoLogger.
    IoLogger(File aFile)
    Constructs a IoLogger.
    IoLogger(File aInputFile, File aErrorFile)
    Constructs a IoLogger.
    IoLogger(OutputStream aOutputStream)
    Constructs a IoLogger.
    IoLogger(OutputStream aOutputStream, OutputStream aErrorStream)
    Constructs a IoLogger.
    IoLogger(PrintStream aPrintStream)
    Constructs a IoLogger.
    IoLogger(PrintStream aOutputStream, PrintStream aErrorStream)
    Constructs a IoLogger.
    IoLogger(org.refcodes.tabular.Header<T> aHeader)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, char aCsvDelimiter)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, File aFile)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, File aFile, char aCsvDelimiter)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, File aInputFile, File aErrorFile)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream, char aCsvDelimiter)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream, OutputStream aErrorStream)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aPrintStream)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aPrintStream, char aCsvDelimiter)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aOutputStream, PrintStream aErrorStream)
    Constructs a IoLogger with the given header for logging.
    IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aOutputStream, PrintStream aErrorStream, char aCsvDelimiter)
    Constructs a IoLogger with the given header for logging.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.refcodes.textual.CsvEscapeMode
    char
    protected org.refcodes.tabular.Header<T>
    Returns the Header used by the IoLogger for usage by sub-classes.
    boolean
    void
    log(org.refcodes.tabular.Record<? extends T> aRecord)
    void
    setCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
    void
    setDelimiter(char aDelimiter)
    void
    void
    setPrintStream(PrintStream aOutputStream)
    void
    setTrim(boolean isTrim)
    withCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
    withDelimiter(char aDelimiterChar)
    withTrim(boolean isTrimRecords)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty

    letCsvEscapeMode

    Methods inherited from interface org.refcodes.mixin.DelimiterAccessor.DelimiterProperty

    letDelimiter

    Methods inherited from interface org.refcodes.logger.LogDecorator

    printHead, printSeparator, printTail

    Methods inherited from interface org.refcodes.mixin.TrimAccessor.TrimProperty

    letTrim
  • Field Details

    • PROPERTY_ERROR_STREAM

      public static final String PROPERTY_ERROR_STREAM
      See Also:
    • PROPERTY_OUTPUT_STREAM

      public static final String PROPERTY_OUTPUT_STREAM
      See Also:
    • _header

      protected org.refcodes.tabular.Header<T> _header
    • _errorStream

      protected PrintStream _errorStream
    • _outputStream

      protected PrintStream _outputStream
    • _csvBuilder

      protected org.refcodes.textual.CsvBuilder _csvBuilder
  • Constructor Details

    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, File aFile) throws FileNotFoundException
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aFile - The File to be used for printing.
      Throws:
      FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, File aFile, char aCsvDelimiter) throws FileNotFoundException
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aFile - The File to be used for printing.
      aCsvDelimiter - The separator to be used when separating the CSV values in the log output.
      Throws:
      FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
    • IoLogger

      public IoLogger(File aInputFile, File aErrorFile) throws FileNotFoundException
      Constructs a IoLogger.
      Parameters:
      aInputFile - The File to be used for printing output.
      aErrorFile - The File to be used for printing errors.
      Throws:
      FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, File aInputFile, File aErrorFile) throws FileNotFoundException
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aInputFile - The File to be used for printing output.
      aErrorFile - The File to be used for printing errors.
      Throws:
      FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
    • IoLogger

      public IoLogger(File aFile) throws FileNotFoundException
      Constructs a IoLogger.
      Parameters:
      aFile - The File to be used for writing to.
      Throws:
      FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aOutputStream - The OutputStream to be used for printing.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream, char aCsvDelimiter)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aOutputStream - The OutputStream to be used for printing.
      aCsvDelimiter - The separator to be used when separating the CSV values in the log output.
    • IoLogger

      public IoLogger(OutputStream aOutputStream, OutputStream aErrorStream)
      Constructs a IoLogger.
      Parameters:
      aOutputStream - The OutputStream to be used for printing output.
      aErrorStream - The OutputStream to be used for printing errors.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, OutputStream aOutputStream, OutputStream aErrorStream)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aOutputStream - The OutputStream to be used for printing output.
      aErrorStream - The OutputStream to be used for printing errors.
    • IoLogger

      public IoLogger(OutputStream aOutputStream)
      Constructs a IoLogger.
      Parameters:
      aOutputStream - The OutputStream to be used for printing.
    • IoLogger

      public IoLogger(PrintStream aPrintStream)
      Constructs a IoLogger.
      Parameters:
      aPrintStream - The PrintStream to be used for printing.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aPrintStream)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aPrintStream - The PrintStream to be used for printing.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aPrintStream, char aCsvDelimiter)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aPrintStream - The PrintStream to be used for printing.
      aCsvDelimiter - The separator to be used when separating the CSV values in the log output.
    • IoLogger

      public IoLogger(PrintStream aOutputStream, PrintStream aErrorStream)
      Constructs a IoLogger.
      Parameters:
      aOutputStream - The PrintStream to be used for printing output.
      aErrorStream - The PrintStream to be used for printing errors.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aOutputStream, PrintStream aErrorStream)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aOutputStream - The PrintStream to be used for printing output.
      aErrorStream - The PrintStream to be used for printing errors.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, PrintStream aOutputStream, PrintStream aErrorStream, char aCsvDelimiter)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aOutputStream - The PrintStream to be used for printing output.
      aErrorStream - The PrintStream to be used for printing errors.
      aCsvDelimiter - The separator to be used when separating the CSV values in the log output.
    • IoLogger

      public IoLogger()
      Constructs a IoLogger.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
    • IoLogger

      public IoLogger(org.refcodes.tabular.Header<T> aHeader, char aCsvDelimiter)
      Constructs a IoLogger with the given header for logging.
      Parameters:
      aHeader - The header used for logging in the correct format.
      aCsvDelimiter - The separator to be used when separating the CSV values in the log output.
  • Method Details

    • getCsvEscapeMode

      public org.refcodes.textual.CsvEscapeMode getCsvEscapeMode()
      Specified by:
      getCsvEscapeMode in interface org.refcodes.textual.CsvEscapeModeAccessor
    • isTrim

      public boolean isTrim()
      Specified by:
      isTrim in interface org.refcodes.mixin.TrimAccessor
    • getDelimiter

      public char getDelimiter()
      Specified by:
      getDelimiter in interface org.refcodes.mixin.DelimiterAccessor
    • setTrim

      public void setTrim(boolean isTrim)
      Specified by:
      setTrim in interface org.refcodes.mixin.TrimAccessor.TrimMutator
    • setDelimiter

      public void setDelimiter(char aDelimiter)
      Specified by:
      setDelimiter in interface org.refcodes.mixin.DelimiterAccessor.DelimiterMutator
    • withTrim

      public IoLogger<T> withTrim(boolean isTrimRecords)
      Specified by:
      withTrim in interface org.refcodes.mixin.TrimAccessor.TrimBuilder<T>
    • withCsvEscapeMode

      public IoLogger<T> withCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
      Specified by:
      withCsvEscapeMode in interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<T>
    • withDelimiter

      public IoLogger<T> withDelimiter(char aDelimiterChar)
      Specified by:
      withDelimiter in interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<T>
    • setCsvEscapeMode

      public void setCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
      Specified by:
      setCsvEscapeMode in interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator
    • log

      public void log(org.refcodes.tabular.Record<? extends T> aRecord) throws org.refcodes.logger.IllegalRecordRuntimeException, org.refcodes.logger.UnexpectedLogRuntimeException
      Specified by:
      log in interface org.refcodes.logger.Logger<T>
      Throws:
      org.refcodes.logger.IllegalRecordRuntimeException
      org.refcodes.logger.UnexpectedLogRuntimeException
    • setErrorPrintStream

      public void setErrorPrintStream(PrintStream aErrorStream)
      Specified by:
      setErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
    • setPrintStream

      public void setPrintStream(PrintStream aOutputStream)
      Specified by:
      setPrintStream in interface org.refcodes.mixin.PrintStreamAccessor.PrintStreamMutator
    • getHeader

      protected org.refcodes.tabular.Header<T> getHeader()
      Returns the Header used by the IoLogger for usage by sub-classes.
      Returns:
      The Header used by the IoLogger.