org.eclipse.aether.transfer

## Class TransferEvent

- java.lang.Object
- - org.eclipse.aether.transfer.TransferEvent

-     public final class TransferEvent
      extends Object

  An event fired to a transfer listener during an artifact/metadata transfer.
  See Also:
    `TransferListener`, `TransferEvent.Builder`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TransferEvent.Builder` A builder to create transfer events.
    `static class` | `TransferEvent.EventType` The type of the event.
    `static class` | `TransferEvent.RequestType` The type of the request/transfer being performed.

  - ### Method Summary

    Methods
    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.
    `RepositorySystemSession` | `getSession()` Gets the repository system session during which the event occurred.
    `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.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getType

          public TransferEvent.EventType getType()

      Gets the type of the event.
      Returns:
        The type of the event, never `null`.

    - #### getRequestType

          public TransferEvent.RequestType getRequestType()

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

    - #### getSession

          public RepositorySystemSession getSession()

      Gets the repository system session during which the event occurred.
      Returns:
        The repository system session during which the event occurred, never `null`.

    - #### getResource

          public TransferResource getResource()

      Gets the resource that is being transferred.
      Returns:
        The resource being transferred, never `null`.

    - #### getTransferredBytes

          public long getTransferredBytes()

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

    - #### getDataBuffer

          public 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 callback, i.e. the next event might reuse the same buffer (with updated contents). Therefore, if the actual event processing is deferred, the byte buffer would have to be cloned to create an immutable snapshot of its 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

          public 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, possibly zero but never negative.
      See Also:
        `getTransferredBytes()`

    - #### getException

          public Exception getException()

      Gets the error that occurred during the transfer.
      Returns:
        The error that occurred or `null` if none.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2010-2012 The Eclipse Foundation. All Rights Reserved.