public class SessionOutputBufferImpl extends ExpandableBuffer implements SessionOutputBuffer
SessionOutputBuffer
based on
the ExpandableBuffer
class.Modifier and Type | Field and Description |
---|---|
private java.nio.CharBuffer |
charBuffer |
private java.nio.charset.CharsetEncoder |
charEncoder |
private static byte[] |
CRLF |
private int |
lineBufferSize |
buffer, INPUT_MODE, OUTPUT_MODE
Constructor and Description |
---|
SessionOutputBufferImpl(int bufferSize)
Creates SessionOutputBufferImpl instance.
|
SessionOutputBufferImpl(int bufferSize,
int lineBufferSize)
Creates SessionOutputBufferImpl instance.
|
SessionOutputBufferImpl(int bufferSize,
int lineBufferSize,
ByteBufferAllocator allocator,
HttpParams params)
Deprecated.
|
SessionOutputBufferImpl(int bufferSize,
int lineBufferSize,
java.nio.charset.Charset charset)
Creates SessionOutputBufferImpl instance.
|
SessionOutputBufferImpl(int bufferSize,
int lineBufferSize,
java.nio.charset.CharsetEncoder charEncoder,
ByteBufferAllocator allocator)
Creates SessionOutputBufferImpl instance.
|
SessionOutputBufferImpl(int bufferSize,
int lineBufferSize,
HttpParams params)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
int |
flush(java.nio.channels.WritableByteChannel channel)
Makes an attempt to flush the content of this buffer to the given
destination
WritableByteChannel . |
void |
reset(HttpParams params) |
private void |
write(byte[] b) |
void |
write(java.nio.ByteBuffer src)
Copies content of the source buffer into this buffer.
|
void |
write(java.nio.channels.ReadableByteChannel src)
Reads a sequence of bytes from the source channel into this buffer.
|
private void |
writeCRLF() |
void |
writeLine(CharArrayBuffer lineBuffer)
Copies content of the source buffer into this buffer as one line of text
including a line delimiter.
|
void |
writeLine(java.lang.String s)
Copies content of the given string into this buffer as one line of text
including a line delimiter.
|
available, capacity, clear, ensureCapacity, expand, getMode, hasData, length, setInputMode, setOutputMode, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hasData, length
private static final byte[] CRLF
private final java.nio.charset.CharsetEncoder charEncoder
private final int lineBufferSize
private java.nio.CharBuffer charBuffer
public SessionOutputBufferImpl(int bufferSize, int lineBufferSize, java.nio.charset.CharsetEncoder charEncoder, ByteBufferAllocator allocator)
bufferSize
- input buffer size.lineBufferSize
- buffer size for line operations. Has effect only if
charEncoder
is not null
.charEncoder
- CharEncoder to be used for encoding HTTP protocol elements.
If null
simple type cast will be used for char to byte conversion.allocator
- memory allocator.
If null
HeapByteBufferAllocator.INSTANCE
will be used.@Deprecated public SessionOutputBufferImpl(int bufferSize, int lineBufferSize, ByteBufferAllocator allocator, HttpParams params)
SessionOutputBufferImpl(int, int, CharsetEncoder,
ByteBufferAllocator)
@Deprecated public SessionOutputBufferImpl(int bufferSize, int lineBufferSize, HttpParams params)
SessionOutputBufferImpl(int, int, Charset)
public SessionOutputBufferImpl(int bufferSize)
bufferSize
- input buffer size.public SessionOutputBufferImpl(int bufferSize, int lineBufferSize, java.nio.charset.Charset charset)
bufferSize
- input buffer size.lineBufferSize
- buffer size for line operations. Has effect only if
charset
is not null
.charset
- Charset to be used for encoding HTTP protocol elements.
If null
simple type cast will be used for char to byte conversion.public SessionOutputBufferImpl(int bufferSize, int lineBufferSize)
bufferSize
- input buffer size.lineBufferSize
- buffer size for line operations.public void reset(HttpParams params)
public int flush(java.nio.channels.WritableByteChannel channel) throws java.io.IOException
SessionOutputBuffer
WritableByteChannel
.flush
in interface SessionOutputBuffer
channel
- the destination channel.java.io.IOException
- in case of an I/O error.public void write(java.nio.ByteBuffer src)
SessionOutputBuffer
write
in interface SessionOutputBuffer
src
- the source buffer.public void write(java.nio.channels.ReadableByteChannel src) throws java.io.IOException
SessionOutputBuffer
write
in interface SessionOutputBuffer
src
- the source channel.java.io.IOException
private void write(byte[] b)
private void writeCRLF()
public void writeLine(CharArrayBuffer lineBuffer) throws java.nio.charset.CharacterCodingException
SessionOutputBuffer
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
writeLine
in interface SessionOutputBuffer
lineBuffer
- the source buffer.java.nio.charset.CharacterCodingException
public void writeLine(java.lang.String s) throws java.io.IOException
SessionOutputBuffer
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
writeLine
in interface SessionOutputBuffer
s
- the string.java.io.IOException