|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.inet.http.ByteArrayResponseBodyReader
public class ByteArrayResponseBodyReader
Simple response body reader that stores content in a byte array.
Field Summary | |
---|---|
protected byte[] |
content
The content. |
protected int |
len
The length of the buffer. |
protected int |
pos
The position in the content at which the next write will occur. |
Constructor Summary | |
---|---|
ByteArrayResponseBodyReader()
Constructs a new byte array response body reader. |
|
ByteArrayResponseBodyReader(int size)
Constructs a new byte array response body reader with the specified initial buffer size. |
Method Summary | |
---|---|
boolean |
accept(Request request,
Response response)
This reader accepts all responses. |
void |
close()
Notifies the reader that the end of the content was reached. |
void |
read(byte[] buffer,
int offset,
int length)
Receive notification of body content. |
byte[] |
toByteArray()
Retrieves the content of this reader as a byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] content
protected int pos
protected int len
Constructor Detail |
---|
public ByteArrayResponseBodyReader()
public ByteArrayResponseBodyReader(int size)
size
- the initial buffer sizeMethod Detail |
---|
public boolean accept(Request request, Response response)
accept
in interface ResponseBodyReader
public void read(byte[] buffer, int offset, int length)
ResponseBodyReader
read
in interface ResponseBodyReader
buffer
- the content bufferoffset
- the offset within the buffer that content startslength
- the length of the contentpublic void close()
ResponseBodyReader
close
in interface ResponseBodyReader
public byte[] toByteArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |