public final class
UploadDataProviders
extends Object
Provides implementations of UploadDataProvider
for common use cases.
Public Method Summary
static UploadDataProvider |
create(File file)
Uploads an entire file.
|
static UploadDataProvider |
create(byte[] data)
Uploads the contents of
data |
static UploadDataProvider |
create(ByteBuffer buffer)
Uploads a ByteBuffer, from the current
buffer.position() to buffer.limit() |
static UploadDataProvider |
create(byte[] data, int offset, int length)
Uploads
length bytes from data , starting from offset |
static UploadDataProvider |
create(ParcelFileDescriptor fd)
Uploads an entire file, closing the descriptor when it is no longer needed.
|
Inherited Method Summary
Public Methods
public static UploadDataProvider create (File file)
Uploads an entire file.
Parameters
file | The file to upload |
---|
Returns
- A new UploadDataProvider for the given file
public static UploadDataProvider create (byte[] data)
Uploads the contents of data
Parameters
data | Array containing data to upload |
---|
Returns
- A new UploadDataProvider for the given data
public static UploadDataProvider create (ByteBuffer buffer)
Uploads a ByteBuffer, from the current buffer.position()
to buffer.limit()
Parameters
buffer | The data to upload |
---|
Returns
- A new UploadDataProvider for the given buffer
public static UploadDataProvider create (byte[] data, int offset, int length)
Uploads length
bytes from data
, starting from offset
Parameters
data | Array containing data to upload |
---|---|
offset | Offset within data to start with |
length | Number of bytes to upload |
Returns
- A new UploadDataProvider for the given data
public static UploadDataProvider create (ParcelFileDescriptor fd)
Uploads an entire file, closing the descriptor when it is no longer needed.
Parameters
fd | The file descriptor to upload |
---|
Returns
- A new UploadDataProvider for the given file descriptor
Throws
IllegalArgumentException | if fd is not a file.
|
---|