Class CollectingStatusListener

java.lang.Object
de.siegmar.fastcsv.reader.CollectingStatusListener
All Implemented Interfaces:
StatusListener

public class CollectingStatusListener extends Object implements StatusListener
Implementation of StatusListener that collects updates.
  • Field Details

    • fileSize

      private volatile long fileSize
    • recordCount

      private final AtomicLong recordCount
    • byteCount

      private final AtomicLong byteCount
    • completionStatus

      private volatile boolean completionStatus
    • failedThrowable

      private volatile Throwable failedThrowable
  • Constructor Details

    • CollectingStatusListener

      public CollectingStatusListener()
      Default constructor.
  • Method Details

    • onInit

      public void onInit(long fileSize)
      Description copied from interface: StatusListener
      Called on initialization.
      Specified by:
      onInit in interface StatusListener
      Parameters:
      fileSize - the total file size.
    • getFileSize

      public long getFileSize()
      Get the total size in bytes.
      Returns:
      the total size in bytes
    • onReadRecord

      public void onReadRecord()
      Description copied from interface: StatusListener
      Called when a new record has been read.
      Specified by:
      onReadRecord in interface StatusListener
    • getRecordCount

      public long getRecordCount()
      Get the number of records already indexed.
      Returns:
      the number of records already indexed
    • onReadBytes

      public void onReadBytes(int bytes)
      Description copied from interface: StatusListener
      Called when a new read operation has been performend.
      Specified by:
      onReadBytes in interface StatusListener
      Parameters:
      bytes - number of bytes read.
    • getByteCount

      public long getByteCount()
      Get the number of bytes already read.
      Returns:
      the number of bytes already read
    • onComplete

      public void onComplete()
      Description copied from interface: StatusListener
      Called when the indexing finished successfully (without an exception).
      Specified by:
      onComplete in interface StatusListener
    • isCompleted

      public boolean isCompleted()
      Get the completion status.
      Returns:
      true, when all data have been indexed successfully
    • onError

      public void onError(Throwable throwable)
      Description copied from interface: StatusListener
      Called when there was an error while indexing.
      Specified by:
      onError in interface StatusListener
      Parameters:
      throwable - the exception thrown.
    • getThrowable

      public Throwable getThrowable()
      Get the throwable that occurred while indexing.
      Returns:
      the throwable that occurred while indexing, null otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object