org.sonatype.aether.transfer
Interface TransferEvent

All Known Implementing Classes:
DefaultTransferEvent

public interface TransferEvent

An event fired to a transfer listener during an artifact/metadata transfer.

Author:
Benjamin Bentmann

Nested Class Summary
static class TransferEvent.EventType
          The type of the event.
static class TransferEvent.RequestType
          The type of the request/transfer.
 
Method Summary
 java.nio.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.
 java.lang.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 so far during the download/upload.
 TransferEvent.EventType getType()
          Gets the type of the event.
 

Method Detail

getType

TransferEvent.EventType getType()
Gets the type of the event.

Returns:
The type of the event, never null.

getRequestType

TransferEvent.RequestType getRequestType()
Gets the type of the request/transfer.

Returns:
The type of the request/transfer, never null.

getResource

TransferResource getResource()
Gets the resource that is being transferred.

Returns:
The resource being transferred, never null.

getTransferredBytes

long getTransferredBytes()
Gets the total number of bytes that have been transferred so far during the download/upload.

Returns:
The total number of bytes that have been transferred since the transfer started, never negative.
See Also:
getDataLength()

getDataBuffer

java.nio.ByteBuffer getDataBuffer()
Gets the byte buffer holding the transferred bytes since the last event. A listener must assume this buffer to be owned by the event source and must not change any byte in this buffer. Also, the buffer is only valid for the duration of the event, i.e. the next event might reuse the same buffer (with updated contents).

Returns:
The (read-only) byte buffer or null if not applicable to the event, i.e. if the event type is not TransferEvent.EventType.PROGRESSED.

getDataLength

int getDataLength()
Gets the number of bytes that have been transferred since the last event.

Returns:
The number of bytes that have been transferred since the last event, never negative.
See Also:
getTransferredBytes()

getException

java.lang.Exception getException()
Gets the error that occurred during the transfer.

Returns:
The error that occurred or null if none.


Copyright © 2010 Sonatype, Inc.. All Rights Reserved.