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.
|
protected 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 ResponseBodyReaderpublic void read(byte[] buffer,
int offset,
int length)
ResponseBodyReaderread in interface ResponseBodyReaderbuffer - the content bufferoffset - the offset within the buffer that content startslength - the length of the contentpublic void close()
ResponseBodyReaderclose in interface ResponseBodyReaderpublic byte[] toByteArray()
© Copyright 2003 The Free Software Foundation, all rights reserved