Class PutTask
- java.lang.Object
-
- org.eclipse.aether.spi.connector.transport.TransportTask
-
- org.eclipse.aether.spi.connector.transport.PutTask
-
public final class PutTask extends TransportTask
A task to upload a resource to the remote repository.- See Also:
Transporter.put(PutTask)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getDataFile()
Gets the file (if any) with the data to be uploaded.long
getDataLength()
Gets the total number of bytes to be uploaded.InputStream
newInputStream()
Opens an input stream for the data to be uploaded.PutTask
setDataBytes(byte[] bytes)
Sets the binary data to be uploaded.PutTask
setDataFile(File dataFile)
Sets the file with the data to be uploaded.PutTask
setDataString(String str)
Sets the textual data to be uploaded.PutTask
setListener(TransportListener listener)
Sets the listener that is to be notified during the transfer.String
toString()
-
Methods inherited from class org.eclipse.aether.spi.connector.transport.TransportTask
getListener, getLocation
-
-
-
-
Method Detail
-
newInputStream
public InputStream newInputStream() throws IOException
Opens an input stream for the data to be uploaded. The length of the stream can be queried viagetDataLength()
. It's the responsibility of the caller to close the provided stream.- Returns:
- The input stream for the data, never
null
. The stream is unbuffered. - Throws:
IOException
- If the stream could not be opened.
-
getDataLength
public long getDataLength()
Gets the total number of bytes to be uploaded.- Returns:
- The total number of bytes to be uploaded.
-
getDataFile
public File getDataFile()
Gets the file (if any) with the data to be uploaded.- Returns:
- The data file or
null
if the data resides in memory.
-
setDataFile
public PutTask setDataFile(File dataFile)
Sets the file with the data to be uploaded. To upload some data residing already in memory, usesetDataString(String)
orsetDataBytes(byte[])
.- Parameters:
dataFile
- The data file, may benull
if the resource data is provided directly from memory.- Returns:
- This task for chaining, never
null
.
-
setDataBytes
public PutTask setDataBytes(byte[] bytes)
Sets the binary data to be uploaded.- Parameters:
bytes
- The binary data, may benull
.- Returns:
- This task for chaining, never
null
.
-
setDataString
public PutTask setDataString(String str)
Sets the textual data to be uploaded. The text is encoded using UTF-8 before transmission.- Parameters:
str
- The textual data, may benull
.- Returns:
- This task for chaining, never
null
.
-
setListener
public PutTask setListener(TransportListener listener)
Sets the listener that is to be notified during the transfer.- Parameters:
listener
- The listener to notify of progress, may benull
.- Returns:
- This task for chaining, never
null
.
-
-