|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.noderunner.http.GeneralDataPoster
public class GeneralDataPoster
A utility class for sending binary data to an HTTP server or client. Example usage:
HttpClient client = new RetryHttpClient("http://example.net"); InputStream fileIS = new FileInputStream("somefile.jpeg"); DataPoster dataPoster = new GeneralDataPoster(fileIS, -1); RequestLine rl = new RequestLineImpl( ... ); ClientRequest request = new ClientRequestImpl(rl, dataPoster); client.writeRequest(request); ClientResponse response = client.readResponse();
Constructor Summary | |
---|---|
GeneralDataPoster(InputStream is,
int len)
Constructs a new GeneralDataPoster that outputs data
from the specified stream. |
Method Summary | |
---|---|
protected int |
getDefaultBufferSize()
Return the default buffer size, which is 1024 bytes. |
void |
sendData(OutputStream os)
Copies our input stream data to the supplied output stream. |
String |
toString()
Returns a debug string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GeneralDataPoster(InputStream is, int len)
GeneralDataPoster
that outputs data
from the specified stream.
is
- input stream to read for outputlen
- if zero, we do nothing, if < 0, we send
chunked data, if > 0 we sent only len
number of
bytesMethod Detail |
---|
public void sendData(OutputStream os) throws IOException
sendData
in interface DataPoster
os
- output stream to send data to
IllegalHttpStateException
- if the input stream was never
set
HttpException
- if the data was already read from our
stream, and the input stream cannot be reset
IOException
- if data could not be writtenprotected int getDefaultBufferSize()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |