public class ByteArrayDataPoster extends Object implements DataPoster
HttpClient client = new RetryHttpClient("http://example.net");
byte buf[] = "This is only a test".getBytes();
DataPoster dataPoster = new ByteArrayDataPoster(buf);
RequestLine rl = new RequestLineImpl( ... );
ClientRequest request = new ClientRequestImpl(rl, dataPoster);
client.writeRequest(request);
ClientResponse response = client.readResponse();
| Constructor and Description |
|---|
ByteArrayDataPoster(byte[] data)
Constructs a
ByteArrayDataPoster,
which will send an entire byte array. |
ByteArrayDataPoster(byte[] data,
int off,
int len)
Constructs a
ByteArrayDataPoster
which will send part of a byte array. |
public ByteArrayDataPoster(byte[] data)
ByteArrayDataPoster,
which will send an entire byte array.public ByteArrayDataPoster(byte[] data,
int off,
int len)
ByteArrayDataPoster
which will send part of a byte array.data - source data arrayoff - zero-based offset in sourcelen - length of array to sendpublic void sendData(OutputStream os) throws IOException
sendData in interface DataPosteros - output stream to send data toIOException - if data could not be writtenCopyright © 2012. All Rights Reserved.