Package org.eclipse.aether.transfer
Class TransferResource
java.lang.Object
org.eclipse.aether.transfer.TransferResource
Describes a resource being uploaded or downloaded by the repository system.
-
Constructor Summary
ConstructorDescriptionTransferResource
(String repositoryId, String repositoryUrl, String resourceName, File file, RequestTrace trace) Creates a new transfer resource with the specified properties. -
Method Summary
Modifier and TypeMethodDescriptionlong
The size of the resource in bytes.getFile()
Gets the local file being uploaded or downloaded.The ID of the repository, e.g., "central".The base URL of the repository, e.g.The path of the resource relative to the repository's base URL, e.g.long
Gets the byte offset within the resource from which the download starts.getTrace()
Gets the trace information that describes the higher level request/operation during which this resource is transferred.long
Gets the timestamp when the transfer of this resource was started.setContentLength
(long contentLength) Sets the size of the resource in bytes.setResumeOffset
(long resumeOffset) Sets the byte offset within the resource at which the download starts.toString()
-
Constructor Details
-
TransferResource
public TransferResource(String repositoryId, String repositoryUrl, String resourceName, File file, RequestTrace trace) Creates a new transfer resource with the specified properties.- Parameters:
repositoryId
- The ID of the repository used to transfer the resource, may benull
or empty if unknown.repositoryUrl
- The base URL of the repository, may benull
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 benull
. A leading slash (if any) will be automatically removed.file
- The source/target file involved in the transfer, may benull
.trace
- The trace information, may benull
.- Since:
- 1.1.0
-
-
Method Details
-
getRepositoryId
The ID of the repository, e.g., "central".- Returns:
- The ID of the repository or an empty string if unknown, never
null
. - Since:
- 1.1.0
-
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
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
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
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 hasstarted
.- Returns:
- The size of the resource in bytes or a negative value if unknown.
-
setContentLength
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
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
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
Gets the timestamp when the transfer of this resource was started.- Returns:
- The timestamp when the transfer of this resource was started.
-
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
-