public static final class TransferEvent.Builder extends Object
Constructor and Description |
---|
Builder(RepositorySystemSession session,
TransferResource resource)
Creates a new transfer event builder for the specified session and the given resource.
|
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(ByteBuffer dataBuffer)
Sets the byte buffer holding the transferred bytes since the last event.
|
TransferEvent.Builder |
setException(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.
|
public Builder(RepositorySystemSession session, TransferResource resource)
session
- The repository system session, must not be null
.resource
- The resource being transferred, must not be null
.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(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(Exception exception)
exception
- The error that occurred during the transfer, may be null
if none.null
.public TransferEvent build()
null
.Copyright © 2010–2021 The Apache Software Foundation. All rights reserved.