public final class PutTask extends TransportTask
Transporter.put(PutTask)
Constructor and Description |
---|
PutTask(URI location)
Creates a new task for the specified remote resource.
|
Modifier and Type | Method and 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() |
getListener, getLocation
public InputStream newInputStream() throws IOException
getDataLength()
. It's the responsibility of the caller to close the provided stream.null
. The stream is unbuffered.IOException
- If the stream could not be opened.public long getDataLength()
public File getDataFile()
null
if the data resides in memory.public PutTask setDataFile(File dataFile)
setDataString(String)
or setDataBytes(byte[])
.dataFile
- The data file, may be null
if the resource data is provided directly from memory.null
.public PutTask setDataBytes(byte[] bytes)
bytes
- The binary data, may be null
.null
.public PutTask setDataString(String str)
str
- The textual data, may be null
.null
.public PutTask setListener(TransportListener listener)
listener
- The listener to notify of progress, may be null
.null
.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.