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()
TransferEvent
getType
in interface TransferEvent
null
.public DefaultTransferEvent setType(TransferEvent.EventType type)
type
- The type of the event, must not be null
.null
.public TransferEvent.RequestType getRequestType()
TransferEvent
getRequestType
in interface TransferEvent
null
.public DefaultTransferEvent setRequestType(TransferEvent.RequestType requestType)
requestType
- The request/transfer type, must not be null
.null
.public TransferResource getResource()
TransferEvent
getResource
in interface TransferEvent
null
.public DefaultTransferEvent setResource(TransferResource resource)
resource
- The resource being transferred, must not be null
.null
.public long getTransferredBytes()
TransferEvent
getTransferredBytes
in interface TransferEvent
TransferEvent.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()
TransferEvent
getDataLength
in interface TransferEvent
TransferEvent.getTransferredBytes()
public ByteBuffer getDataBuffer()
TransferEvent
getDataBuffer
in interface TransferEvent
null
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()
TransferEvent
getException
in interface TransferEvent
null
if none.public DefaultTransferEvent setException(Exception exception)
exception
- The error that occurred during the transfer, may be null
if none.null
.Copyright © 2010-2012 Sonatype, Inc.. All Rights Reserved.