org.eclipse.aether.transfer

## Class TransferEvent.Builder

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

- Enclosing class:
    TransferEvent

      public static final class TransferEvent.Builder
      extends Object

  A builder to create transfer events.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransferEvent.Builder(RepositorySystemSession session, TransferResource resource)` Creates a new transfer event builder for the specified session and the given resource.

  - ### Method Summary

    Methods
    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` | `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.
    `TransferEvent.Builder` | `setType(TransferEvent.EventType type)` Sets the type of the event.

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

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

- - ### Constructor Detail

    - #### TransferEvent.Builder

          public TransferEvent.Builder(RepositorySystemSession session,
                               TransferResource resource)

      Creates a new transfer event builder for the specified session and the given resource.
      Parameters:
        `session` - The repository system session, must not be `null`.
        `resource` - The resource being transferred, must not be `null`.

  - ### Method Detail

    - #### copy

          public TransferEvent.Builder copy()

      Creates a new transfer event builder from the current values of this builder. The state of this builder remains unchanged.
      Returns:
        The new event builder, never `null`.

    - #### setType

          public TransferEvent.Builder setType(TransferEvent.EventType type)

      Sets the type of the event.
      Parameters:
        `type` - The type of the event, must not be `null`.
      Returns:
        This event builder for chaining, never `null`.

    - #### setRequestType

          public TransferEvent.Builder setRequestType(TransferEvent.RequestType requestType)

      Sets the type of the request/transfer.
      Parameters:
        `requestType` - The request/transfer type, must not be `null`.
      Returns:
        This event builder for chaining, never `null`.

    - #### setTransferredBytes

          public TransferEvent.Builder setTransferredBytes(long transferredBytes)

      Sets the total number of bytes that have been transferred so far during the download/upload.
      Parameters:
        `transferredBytes` - The total number of bytes that have been transferred so far during the download/upload, must not be negative.
      Returns:
        This event builder for chaining, never `null`.

    - #### addTransferredBytes

          public TransferEvent.Builder addTransferredBytes(long transferredBytes)

      Increments the total number of bytes that have been transferred so far during the download/upload.
      Parameters:
        `transferredBytes` - The number of bytes that have been transferred since the last event, must not be negative.
      Returns:
        This event builder for chaining, never `null`.

    - #### setDataBuffer

          public TransferEvent.Builder setDataBuffer(byte[] buffer,
                                            int offset,
                                            int length)

      Sets the byte buffer holding the transferred bytes since the last event.
      Parameters:
        `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.
      Returns:
        This event builder for chaining, never `null`.

    - #### setDataBuffer

          public TransferEvent.Builder setDataBuffer(ByteBuffer dataBuffer)

      Sets the byte buffer holding the transferred bytes since the last event.
      Parameters:
        `dataBuffer` - The byte buffer holding the transferred bytes since the last event, may be `null` if not applicable to the event.
      Returns:
        This event builder for chaining, never `null`.

    - #### setException

          public TransferEvent.Builder setException(Exception exception)

      Sets the error that occurred during the transfer.
      Parameters:
        `exception` - The error that occurred during the transfer, may be `null` if none.
      Returns:
        This event builder for chaining, never `null`.

    - #### build

          public TransferEvent build()

      Builds a new transfer event from the current values of this builder. The state of the builder itself remains unchanged.
      Returns:
        The transfer event, never `null`.

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