public class ByteArrayDownloadTarget extends AbstractFileTransfer implements DownloadTarget
Modifier and Type | Field and Description |
---|---|
private ByteArrayOutputStream |
data |
private int |
limit |
Constructor and Description |
---|
ByteArrayDownloadTarget(String name)
Create a new byte array download target with "unlimited" size.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getData()
Get the downloaded data as a byte array.
|
int |
getDownloadedSize()
Get the size of the downloaded data.
|
OutputStream |
getOutputStream()
Get an ouput stream for writing the file data to the
local resource.
|
String |
getString(String charset)
Get the downloaded data as a string.
|
getMetadata, getName, initMetadata
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetadata, getName
private final int limit
private ByteArrayOutputStream data
public ByteArrayDownloadTarget(String name)
name
- The name of the "file"public OutputStream getOutputStream()
DownloadTarget
getOutputStream
in interface DownloadTarget
public int getDownloadedSize()
public byte[] getData()