com.univocity.api.statistics
Interface DataTransfer<S,T>

Type Parameters:
S - the source of data, where data is coming from
T - the target of data, where data is being transferred into.
All Known Implementing Classes:
DataTransferListener, DataTransferStatistics, DownloadListener, DownloadStatistics, NoopDataTransfer

public interface DataTransfer<S,T>

A callback interface used to receive notifications of data transfers from a source to a target. Information about sizes transferred are implementation dependent and can signify bytes transferred, number of records, etc.

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Method Summary
 void aborted(S source, T target, Exception error)
          Notifies that the data transfer has been aborted.
 void completed(S source, T target)
          Notifies that a data transfer has been finalized.
 boolean isAborted()
          Returns a flag indicating whether the data transfer was aborted.
 boolean isRunning()
          Returns a flag indicating whether the data transfer is running.
 boolean isStarted()
          Returns a flag indicating whether the data transfer has been started.
 void started(S source, long totalSize, T target)
          Notifies a data transfer has been started.
 void transferred(S source, long transferred, T target)
          Notifies how much data has been transferred from source to target.
 

Method Detail

started

void started(S source,
             long totalSize,
             T target)
Notifies a data transfer has been started.

Parameters:
source - the source of data
totalSize - the total size of the data. The meaning of the amount provided depends on the underlying implementation: this can be bytes, number of records, etc. If -1, the total size is unknown ahead of time.
target - the data target

transferred

void transferred(S source,
                 long transferred,
                 T target)
Notifies how much data has been transferred from source to target. Can be invoked multiple times until the data transfer is completed or aborted.

Parameters:
source - the source of data
transferred - the amount of data transferred since the last time this method was called. The meaning of the amount provided depends on the underlying implementation: this can be bytes, number of records, etc.
target - the data target

completed

void completed(S source,
               T target)
Notifies that a data transfer has been finalized.

Parameters:
source - the source of data
target - the data target

aborted

void aborted(S source,
             T target,
             Exception error)
Notifies that the data transfer has been aborted.

Parameters:
source - the source of data
target - the data target
error - exception that caused the process abortion.

isStarted

boolean isStarted()
Returns a flag indicating whether the data transfer has been started.

Returns:
a flag indicating whether the data transfer has been started.

isRunning

boolean isRunning()
Returns a flag indicating whether the data transfer is running.

Returns:
a flag indicating whether the data transfer is running.

isAborted

boolean isAborted()
Returns a flag indicating whether the data transfer was aborted.

Returns:
a flag indicating whether the data transfer was aborted.


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.