public static final class TransferEvent.Builder
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) java.nio.ByteBuffer |
dataBuffer |
(package private) java.lang.Exception |
exception |
(package private) TransferEvent.RequestType |
requestType |
(package private) TransferResource |
resource |
(package private) RepositorySystemSession |
session |
(package private) long |
transferredBytes |
(package private) TransferEvent.EventType |
type |
| Modifier | Constructor and Description |
|---|---|
|
Builder(RepositorySystemSession session,
TransferResource resource)
Creates a new transfer event builder for the specified session and the given resource.
|
private |
Builder(TransferEvent.Builder prototype) |
| Modifier and Type | Method and Description |
|---|---|
TransferEvent.Builder |
addTransferredBytes(long transferredBytes)
Increments the total number of bytes that have been transferred so far during the download/upload.
|
TransferEvent |
build()
Builds a new transfer event from the current values of this builder.
|
TransferEvent.Builder |
copy()
Creates a new transfer event builder from the current values of this builder.
|
TransferEvent.Builder |
resetType(TransferEvent.EventType type)
Sets the type of the event and resets event-specific fields.
|
TransferEvent.Builder |
setDataBuffer(byte[] buffer,
int offset,
int length)
Sets the byte buffer holding the transferred bytes since the last event.
|
TransferEvent.Builder |
setDataBuffer(java.nio.ByteBuffer dataBuffer)
Sets the byte buffer holding the transferred bytes since the last event.
|
TransferEvent.Builder |
setException(java.lang.Exception exception)
Sets the error that occurred during the transfer.
|
TransferEvent.Builder |
setRequestType(TransferEvent.RequestType requestType)
Sets the type of the request/transfer.
|
TransferEvent.Builder |
setTransferredBytes(long transferredBytes)
Sets the total number of bytes that have been transferred so far during the download/upload of the resource.
|
TransferEvent.Builder |
setType(TransferEvent.EventType type)
Sets the type of the event.
|
TransferEvent.EventType type
TransferEvent.RequestType requestType
RepositorySystemSession session
TransferResource resource
java.nio.ByteBuffer dataBuffer
long transferredBytes
java.lang.Exception exception
public Builder(RepositorySystemSession session, TransferResource resource)
session - The repository system session, must not be null.resource - The resource being transferred, must not be null.private Builder(TransferEvent.Builder prototype)
public TransferEvent.Builder copy()
null.public TransferEvent.Builder resetType(TransferEvent.EventType type)
null. Furthermore, the total number of transferred bytes is set to
0 if the event type is TransferEvent.EventType.STARTED.type - The type of the event, must not be null.null.public TransferEvent.Builder setType(TransferEvent.EventType type)
resetType(TransferEvent.EventType) might be more handy.type - The type of the event, must not be null.null.public TransferEvent.Builder setRequestType(TransferEvent.RequestType requestType)
requestType - The request/transfer type, must not be null.null.public TransferEvent.Builder setTransferredBytes(long transferredBytes)
TransferEvent.EventType.STARTED
should indicate from what byte the download resumes.transferredBytes - The total number of bytes that have been transferred so far during the
download/upload of the resource, must not be negative.null.TransferResource.setResumeOffset(long)public TransferEvent.Builder addTransferredBytes(long transferredBytes)
transferredBytes - The number of bytes that have been transferred since the last event, must not be
negative.null.public TransferEvent.Builder setDataBuffer(byte[] buffer, int offset, int length)
buffer - The byte buffer holding the transferred bytes since the last event, may be null if not
applicable to the event.offset - The starting point of valid bytes in the array.length - The number of valid bytes, must not be negative.null.public TransferEvent.Builder setDataBuffer(java.nio.ByteBuffer dataBuffer)
dataBuffer - The byte buffer holding the transferred bytes since the last event, may be null if
not applicable to the event.null.public TransferEvent.Builder setException(java.lang.Exception exception)
exception - The error that occurred during the transfer, may be null if none.null.public TransferEvent build()
null.