Top Description Fields Constructors Methods
de.siegmar.fastcsv.reader

public Class CollectingStatusListener

extends Object
implements StatusListener
Class Inheritance
All Implemented Interfaces
de.siegmar.fastcsv.reader.StatusListener
Imports
java.util.Optional, java.util.concurrent.atomic.AtomicBoolean, .AtomicLong, .AtomicReference

Implementation of StatusListener that collects updates.

Field Summary

Modifier and TypeField and Description
private final AtomicLong
private final AtomicBoolean
private final AtomicReference<Throwable>
private final AtomicLong
private final AtomicLong

Constructor Summary

AccessConstructor and Description
public
CollectingStatusListener()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the number of bytes already read
getByteCount
()

Get the number of bytes already read.

public long

Returns:

the total size in bytes
getFileSize
()

Get the total size in bytes.

public long

Returns:

the number of records already indexed
getRecordCount
()

Get the number of records already indexed.

public Optional<Throwable>

Returns:

the throwable that occurred while indexing.
getThrowable
()

Get the throwable that occurred while indexing.

public boolean

Returns:

true, when all data have been indexed successfully
isCompleted
()

Get the completion status.

public void
onComplete()

Overrides default de.siegmar.fastcsv.reader.StatusListener.onComplete.

Called when the indexing finished successfully (without an exception).

public void
onError(final Throwable throwable)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onError.

Called when there was an error while indexing.

public void
onInit(final long fileSize)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onInit.

Called on initialization.

public void
onReadBytes(final int bytes)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onReadBytes.

Called when a new read operation has been performend.

public void
onReadRecord()

Overrides default de.siegmar.fastcsv.reader.StatusListener.onReadRecord.

Called when a new record has been read.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

byteCountback to summary
private final AtomicLong byteCount
completionStatusback to summary
private final AtomicBoolean completionStatus
failedThrowableback to summary
private final AtomicReference<Throwable> failedThrowable
fileSizeback to summary
private final AtomicLong fileSize
recordCountback to summary
private final AtomicLong recordCount

Constructor Detail

CollectingStatusListenerback to summary
public CollectingStatusListener()

Default constructor.

Annotations
@SuppressWarnings:PMD.UnnecessaryConstructor

Method Detail

getByteCountback to summary
public long getByteCount()

Get the number of bytes already read.

Returns:long

the number of bytes already read

getFileSizeback to summary
public long getFileSize()

Get the total size in bytes.

Returns:long

the total size in bytes

getRecordCountback to summary
public long getRecordCount()

Get the number of records already indexed.

Returns:long

the number of records already indexed

getThrowableback to summary
public Optional<Throwable> getThrowable()

Get the throwable that occurred while indexing.

Returns:Optional<Throwable>

the throwable that occurred while indexing.

isCompletedback to summary
public boolean isCompleted()

Get the completion status.

Returns:boolean

true, when all data have been indexed successfully

onCompleteback to summary
public void onComplete()

Overrides default de.siegmar.fastcsv.reader.StatusListener.onComplete.

Doc from de.siegmar.fastcsv.reader.StatusListener.onComplete.

Called when the indexing finished successfully (without an exception).

Annotations
@Override
onErrorback to summary
public void onError(final Throwable throwable)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onError.

Doc from de.siegmar.fastcsv.reader.StatusListener.onError.

Called when there was an error while indexing.

Annotations
@Override
onInitback to summary
public void onInit(final long fileSize)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onInit.

Doc from de.siegmar.fastcsv.reader.StatusListener.onInit.

Called on initialization.

Annotations
@SuppressWarnings:checkstyle:HiddenField
@Override
onReadBytesback to summary
public void onReadBytes(final int bytes)

Overrides default de.siegmar.fastcsv.reader.StatusListener.onReadBytes.

Doc from de.siegmar.fastcsv.reader.StatusListener.onReadBytes.

Called when a new read operation has been performend.

Annotations
@Override
onReadRecordback to summary
public void onReadRecord()

Overrides default de.siegmar.fastcsv.reader.StatusListener.onReadRecord.

Doc from de.siegmar.fastcsv.reader.StatusListener.onReadRecord.

Called when a new record has been read.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override