public class ByteArrayResponseBodyReader extends java.lang.Object implements ResponseBodyReader
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected byte[] content
protected int pos
protected int len
public ByteArrayResponseBodyReader()
public ByteArrayResponseBodyReader(int size)
size - the initial buffer sizepublic 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()