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) Deprecated.TransferResource
(String repositoryId, String repositoryUrl, String resourceName, Path path, Object resource, RequestTrace trace) Creates a new transfer resource with the specified properties. -
Method Summary
Modifier and TypeMethodDescriptionstatic Clock
getClock()
long
The size of the resource in bytes.getFile()
Deprecated.UsegetPath()
instead.getPath()
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 representation of "resource", if any.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.Gets 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.long
Deprecated.usegetStartTime()
static void
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
@Deprecated public TransferResource(String repositoryId, String repositoryUrl, String resourceName, File file, RequestTrace trace) Deprecated.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
-
TransferResource
public TransferResource(String repositoryId, String repositoryUrl, String resourceName, Path path, Object resource, 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.path
- The source/target file involved in the transfer, may benull
.resource
- The representation of this resource, may benull
.trace
- The trace information, may benull
.- Since:
- 2.0.0
-
-
Method Details
-
getClock
-
setClock
-
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. "https://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
.
-
getResource
The representation of "resource", if any. The content of this field may beArtifact
orMetadata
ornull
in case of some legacy flow. Preferred way to handle returned value is withinstanceof
.- Returns:
- The representation of this resource, may be
null
. - Since:
- 2.0.0
-
getFile
Deprecated.UsegetPath()
instead.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.
-
getPath
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. - Since:
- 2.0.0
-
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
Deprecated.usegetStartTime()
Gets the timestamp when the transfer of this resource was started.- Returns:
- The timestamp when the transfer of this resource was started.
-
getStartTime
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
-
TransferResource(java.lang.String,java.lang.String,java.lang.String,java.nio.file.Path,java.lang.Object,org.eclipse.aether.RequestTrace)
instead.