java.lang.Object
de.siegmar.fastcsv.reader.CollectingStatusListener
- All Implemented Interfaces:
StatusListener
Implementation of
StatusListener
that collects updates.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicLong
private boolean
private Throwable
private long
private final AtomicLong
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the number of bytes already read.long
Get the total size in bytes.long
Get the number of records already indexed.Get the throwable that occurred while indexing.boolean
Get the completion status.void
Called when the indexing finished successfully (without an exception).void
Called when there was an error while indexing.void
onInit
(long fileSize) Called on initialization.void
onReadBytes
(int bytes) Called when a new read operation has been performend.void
Called when a new record has been read.toString()
-
Field Details
-
fileSize
private volatile long fileSize -
recordCount
-
byteCount
-
completionStatus
private volatile boolean completionStatus -
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 interfaceStatusListener
- 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 interfaceStatusListener
-
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 interfaceStatusListener
- 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 interfaceStatusListener
-
isCompleted
public boolean isCompleted()Get the completion status.- Returns:
true
, when all data have been indexed successfully
-
onError
Description copied from interface:StatusListener
Called when there was an error while indexing.- Specified by:
onError
in interfaceStatusListener
- Parameters:
throwable
- the exception thrown.
-
getThrowable
Get the throwable that occurred while indexing.- Returns:
- the throwable that occurred while indexing,
null
otherwise.
-
toString
-