org.eclipse.aether.transfer

## Class TransferResource

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

-     public final class TransferResource
      extends Object

  Describes a resource being uploaded or downloaded by the repository system.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransferResource(String repositoryUrl, String resourceName, File file, RequestTrace trace)` Creates a new transfer resource with the specified properties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getContentLength()` The size of the resource in bytes.
    `File` | `getFile()` Gets the local file being uploaded or downloaded.
    `String` | `getRepositoryUrl()` The base URL of the repository, e.g.
    `String` | `getResourceName()` The path of the resource relative to the repository's base URL, e.g.
    `long` | `getResumeOffset()` Gets the byte offset within the resource from which the download starts.
    `RequestTrace` | `getTrace()` Gets the trace information that describes the higher level request/operation during which this resource is transferred.
    `long` | `getTransferStartTime()` Gets the timestamp when the transfer of this resource was started.
    `TransferResource` | `setContentLength(long contentLength)` Sets the size of the resource in bytes.
    `TransferResource` | `setResumeOffset(long resumeOffset)` Sets the byte offset within the resource at which the download starts.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### TransferResource

          public TransferResource(String repositoryUrl,
                          String resourceName,
                          File file,
                          RequestTrace trace)

      Creates a new transfer resource with the specified properties.
      Parameters:
        `repositoryUrl` - The base URL of the repository, may be `null` or empty if unknown. If not empty, a trailing slash will automatically be added if missing.
        `resourceName` - The relative path to the resource within the repository, may be `null`. A leading slash (if any) will be automatically removed.
        `file` - The source/target file involved in the transfer, may be `null`.
        `trace` - The trace information, may be `null`.

  - ### Method Detail

    - #### getRepositoryUrl

          public String getRepositoryUrl()

      The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be terminated by a trailing slash.
      Returns:
        The base URL of the repository or an empty string if unknown, never `null`.

    - #### getResourceName

          public String getResourceName()

      The path of the resource relative to the repository's base URL, e.g. "org/apache/maven/maven/3.0/maven-3.0.pom".
      Returns:
        The path of the resource, never `null`.

    - #### getFile

          public File getFile()

      Gets the local file being uploaded or downloaded. When the repository system merely checks for the existence of a remote resource, no local file will be involved in the transfer.
      Returns:
        The source/target file involved in the transfer or `null` if none.

    - #### getContentLength

          public long getContentLength()

      The size of the resource in bytes. Note that the size of a resource during downloads might be unknown to the client which is usually the case when transfers employ compression like gzip. In general, the content length is not known until the transfer has `started`.
      Returns:
        The size of the resource in bytes or a negative value if unknown.

    - #### setContentLength

          public TransferResource setContentLength(long contentLength)

      Sets the size of the resource in bytes.
      Parameters:
        `contentLength` - The size of the resource in bytes or a negative value if unknown.
      Returns:
        This resource for chaining, never `null`.

    - #### getResumeOffset

          public long getResumeOffset()

      Gets the byte offset within the resource from which the download starts. A positive offset indicates a previous download attempt is being resumed, `0` means the transfer starts at the first byte.
      Returns:
        The zero-based index of the first byte being transferred, never negative.

    - #### setResumeOffset

          public TransferResource setResumeOffset(long resumeOffset)

      Sets the byte offset within the resource at which the download starts.
      Parameters:
        `resumeOffset` - The zero-based index of the first byte being transferred, must not be negative.
      Returns:
        This resource for chaining, never `null`.

    - #### getTransferStartTime

          public long getTransferStartTime()

      Gets the timestamp when the transfer of this resource was started.
      Returns:
        The timestamp when the transfer of this resource was started.

    - #### getTrace

          public RequestTrace getTrace()

      Gets the trace information that describes the higher level request/operation during which this resource is transferred.
      Returns:
        The trace information about the higher level operation or `null` if none.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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