@NotThreadSafe public class SessionInputBufferImpl extends ExpandableBuffer implements SessionInputBuffer
SessionInputBuffer
based on
the ExpandableBuffer
class.buffer, INPUT_MODE, OUTPUT_MODE
Constructor and Description |
---|
SessionInputBufferImpl(int buffersize) |
SessionInputBufferImpl(int buffersize,
int lineBuffersize) |
SessionInputBufferImpl(int buffersize,
int lineBuffersize,
ByteBufferAllocator allocator,
HttpParams params)
Deprecated.
|
SessionInputBufferImpl(int buffersize,
int lineBuffersize,
Charset charset) |
SessionInputBufferImpl(int buffersize,
int lineBuffersize,
CharsetDecoder chardecoder,
ByteBufferAllocator allocator)
Creates SessionInputBufferImpl instance.
|
SessionInputBufferImpl(int buffersize,
int linebuffersize,
HttpParams params)
Deprecated.
|
SessionInputBufferImpl(int buffersize,
int lineBuffersize,
MessageConstraints constraints,
Charset charset) |
SessionInputBufferImpl(int buffersize,
int lineBuffersize,
MessageConstraints constraints,
CharsetDecoder chardecoder,
ByteBufferAllocator allocator)
Creates SessionInputBufferImpl instance.
|
Modifier and Type | Method and Description |
---|---|
int |
fill(ReadableByteChannel channel)
Makes an attempt to fill the buffer with data from the given
ReadableByteChannel . |
int |
read()
Reads one byte from the buffer.
|
int |
read(ByteBuffer dst)
Reads a sequence of bytes from this buffer into the destination buffer.
|
int |
read(ByteBuffer dst,
int maxLen)
Reads a sequence of bytes from this buffer into the destination buffer,
up to the given maximum limit.
|
int |
read(WritableByteChannel dst)
Reads a sequence of bytes from this buffer into the destination channel.
|
int |
read(WritableByteChannel dst,
int maxLen)
Reads a sequence of bytes from this buffer into the destination channel,
up to the given maximum limit.
|
String |
readLine(boolean endOfStream)
Attempts to transfer a complete line of characters up to a line delimiter
from this buffer to a newly created string.
|
boolean |
readLine(CharArrayBuffer linebuffer,
boolean endOfStream)
Attempts to transfer a complete line of characters up to a line delimiter
from this buffer to the destination buffer.
|
available, capacity, clear, ensureCapacity, expand, getMode, hasData, length, setInputMode, setOutputMode, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hasData, length
public SessionInputBufferImpl(int buffersize, int lineBuffersize, MessageConstraints constraints, CharsetDecoder chardecoder, ByteBufferAllocator allocator)
buffersize
- input buffer sizelineBuffersize
- buffer size for line operations. Has effect only if
chardecoder
is not null
.chardecoder
- chardecoder to be used for decoding HTTP protocol elements.
If null
simple type cast will be used for byte to char conversion.constraints
- Message constraints. If null
MessageConstraints.DEFAULT
will be used.allocator
- memory allocator.
If null
HeapByteBufferAllocator.INSTANCE
will be used.public SessionInputBufferImpl(int buffersize, int lineBuffersize, CharsetDecoder chardecoder, ByteBufferAllocator allocator)
buffersize
- input buffer sizelineBuffersize
- buffer size for line operations. Has effect only if
chardecoder
is not null
.chardecoder
- chardecoder to be used for decoding HTTP protocol elements.
If null
simple type cast will be used for byte to char conversion.allocator
- memory allocator.
If null
HeapByteBufferAllocator.INSTANCE
will be used.@Deprecated public SessionInputBufferImpl(int buffersize, int lineBuffersize, ByteBufferAllocator allocator, HttpParams params)
SessionInputBufferImpl(int, int, CharsetDecoder,
ByteBufferAllocator)
@Deprecated public SessionInputBufferImpl(int buffersize, int linebuffersize, HttpParams params)
SessionInputBufferImpl(int, int, Charset)
public SessionInputBufferImpl(int buffersize, int lineBuffersize, Charset charset)
public SessionInputBufferImpl(int buffersize, int lineBuffersize, MessageConstraints constraints, Charset charset)
public SessionInputBufferImpl(int buffersize, int lineBuffersize)
public SessionInputBufferImpl(int buffersize)
public int fill(ReadableByteChannel channel) throws IOException
SessionInputBuffer
ReadableByteChannel
.fill
in interface SessionInputBuffer
channel
- the source channel-1
if the
channel has reached end-of-stream.IOException
- in case of an I/O error.public int read()
SessionInputBuffer
read
in interface SessionInputBuffer
public int read(ByteBuffer dst, int maxLen)
SessionInputBuffer
maxLen
value.read
in interface SessionInputBuffer
dst
- the destination buffer.maxLen
- the maximum number of bytes to be read.public int read(ByteBuffer dst)
SessionInputBuffer
read
in interface SessionInputBuffer
dst
- the destination buffer.public int read(WritableByteChannel dst, int maxLen) throws IOException
SessionInputBuffer
maxLen
value.read
in interface SessionInputBuffer
dst
- the destination channel.maxLen
- the maximum number of bytes to be read.IOException
- in case of an I/O error.public int read(WritableByteChannel dst) throws IOException
SessionInputBuffer
read
in interface SessionInputBuffer
dst
- the destination channel.IOException
- in case of an I/O error.public boolean readLine(CharArrayBuffer linebuffer, boolean endOfStream) throws CharacterCodingException
SessionInputBuffer
true
. The line
delimiter itself is discarded. If a complete line is not available in
the buffer, this method returns false
without transferring
anything to the destination buffer. If endOfStream
parameter
is set to true
this method assumes the end of stream has
been reached and the content currently stored in the buffer should be
treated as a complete line.
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
readLine
in interface SessionInputBuffer
linebuffer
- the destination buffer.endOfStream
- end of stream flagtrue
if a sequence of chars representing a complete
line has been transferred to the destination buffer, false
otherwise.CharacterCodingException
- in case a character encoding or decoding
error occurs.public String readLine(boolean endOfStream) throws CharacterCodingException
SessionInputBuffer
null
. If endOfStream
parameter
is set to true
this method assumes the end of stream has
been reached and the content currently stored in the buffer should be
treated as a complete line.
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
readLine
in interface SessionInputBuffer
endOfStream
- end of stream flagnull
otherwise.CharacterCodingException
- in case a character encoding or decoding
error occurs.Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.