public class DefaultTransferEvent extends Object implements TransferEvent
TransferEvent.EventType, TransferEvent.RequestType| Constructor and Description |
|---|
DefaultTransferEvent()
Creates a new and uninitialized transfer event.
|
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
getDataBuffer()
Gets the byte buffer holding the transferred bytes since the last event.
|
int |
getDataLength()
Gets the number of bytes that have been transferred since the last event.
|
Exception |
getException()
Gets the error that occurred during the transfer.
|
TransferEvent.RequestType |
getRequestType()
Gets the type of the request/transfer.
|
TransferResource |
getResource()
Gets the resource that is being transferred.
|
long |
getTransferredBytes()
Gets the total number of bytes that have been transferred since the download/upload was started.
|
TransferEvent.EventType |
getType()
Gets the type of the event.
|
DefaultTransferEvent |
setDataBuffer(byte[] buffer,
int offset,
int length)
Wraps the given
byte[]-array into a ByteBuffer as the content for this event. |
DefaultTransferEvent |
setDataBuffer(ByteBuffer dataBuffer)
Sets the byte buffer holding the transferred bytes since the last event.
|
DefaultTransferEvent |
setException(Exception exception)
Sets the error that occurred during the transfer.
|
DefaultTransferEvent |
setRequestType(TransferEvent.RequestType requestType)
Sets the type of the request/transfer.
|
DefaultTransferEvent |
setResource(TransferResource resource)
Sets the resource being transferred.
|
DefaultTransferEvent |
setTransferredBytes(long transferredBytes)
Sets the total number of bytes that have been transferred so far during the download/upload.
|
DefaultTransferEvent |
setType(TransferEvent.EventType type)
Sets the type of the event.
|
String |
toString() |
public DefaultTransferEvent()
public TransferEvent.EventType getType()
TransferEventgetType in interface TransferEventnull.public DefaultTransferEvent setType(TransferEvent.EventType type)
type - The type of the event, must not be null.null.public TransferEvent.RequestType getRequestType()
TransferEventgetRequestType in interface TransferEventnull.public DefaultTransferEvent setRequestType(TransferEvent.RequestType requestType)
requestType - The request/transfer type, must not be null.null.public TransferResource getResource()
TransferEventgetResource in interface TransferEventnull.public DefaultTransferEvent setResource(TransferResource resource)
resource - The resource being transferred, must not be null.null.public long getTransferredBytes()
TransferEventgetTransferredBytes in interface TransferEventTransferEvent.getDataLength()public DefaultTransferEvent setTransferredBytes(long transferredBytes)
transferredBytes - The total number of bytes that have been transferred so far during the download/upload,
must not be negative.null.public int getDataLength()
TransferEventgetDataLength in interface TransferEventTransferEvent.getTransferredBytes()public ByteBuffer getDataBuffer()
TransferEventgetDataBuffer in interface TransferEventnull if not applicable to the event, i.e. if the event type is not
TransferEvent.EventType.PROGRESSED.public DefaultTransferEvent setDataBuffer(byte[] buffer, int offset, int length)
byte[]-array into a ByteBuffer as the content for this event.buffer - The array to use, must not be null.offset - the starting point of valid bytes in the array.length - the number of valid bytes.null.public DefaultTransferEvent setDataBuffer(ByteBuffer dataBuffer)
dataBuffer - The byte buffer holding the transferred bytes since the last event, may be null.null.public Exception getException()
TransferEventgetException in interface TransferEventnull if none.public DefaultTransferEvent setException(Exception exception)
exception - The error that occurred during the transfer, may be null if none.null.Copyright © 2010-2015 Sonatype, Inc.. All Rights Reserved.