gnu.inet.http
Class ByteArrayResponseBodyReader
java.lang.Object
gnu.inet.http.ByteArrayResponseBodyReader
- ResponseBodyReader
public class ByteArrayResponseBodyReader
extends java.lang.Object
Simple response body reader that stores content in a byte array.
- Chris Burdess
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.
|
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.
|
content
protected byte[] content
The content.
len
protected int len
The length of the buffer.
pos
protected int pos
The position in the content at which the next write will occur.
ByteArrayResponseBodyReader
public ByteArrayResponseBodyReader()
Constructs a new byte array response body reader.
ByteArrayResponseBodyReader
public ByteArrayResponseBodyReader(int size)
Constructs a new byte array response body reader with the specified
initial buffer size.
size
- the initial buffer size
close
public void close()
Notifies the reader that the end of the content was reached.
- close in interface ResponseBodyReader
read
public void read(byte[] buffer,
int offset,
int length)
Receive notification of body content.
- read in interface ResponseBodyReader
buffer
- the content bufferoffset
- the offset within the buffer that content startslength
- the length of the content
toByteArray
public byte[] toByteArray()
Retrieves the content of this reader as a byte array.
The size of the returned array is the number of bytes read.
© Copyright 2003 The Free Software Foundation,
all rights reserved