org.apache.http.impl.nio.reactor
Class SessionOutputBufferImpl

java.lang.Object
  extended by org.apache.http.nio.util.ExpandableBuffer
      extended by org.apache.http.impl.nio.reactor.SessionOutputBufferImpl
All Implemented Interfaces:
SessionOutputBuffer, BufferInfo

@NotThreadSafe
public class SessionOutputBufferImpl
extends ExpandableBuffer
implements SessionOutputBuffer

Default implementation of SessionOutputBuffer based on the ExpandableBuffer class.

Since:
4.0

Field Summary
 
Fields inherited from class org.apache.http.nio.util.ExpandableBuffer
buffer, INPUT_MODE, OUTPUT_MODE
 
Constructor Summary
SessionOutputBufferImpl(int buffersize)
           
SessionOutputBufferImpl(int buffersize, int linebuffersize)
           
SessionOutputBufferImpl(int buffersize, int lineBuffersize, ByteBufferAllocator allocator, HttpParams params)
          Deprecated. (4.3) use SessionOutputBufferImpl(int, int, CharsetEncoder, ByteBufferAllocator)
SessionOutputBufferImpl(int buffersize, int linebuffersize, Charset charset)
           
SessionOutputBufferImpl(int buffersize, int lineBuffersize, CharsetEncoder charencoder, ByteBufferAllocator allocator)
          Creates SessionOutputBufferImpl instance.
SessionOutputBufferImpl(int buffersize, int linebuffersize, HttpParams params)
          Deprecated. (4.3) use SessionOutputBufferImpl(int, int, Charset)
 
Method Summary
 int flush(WritableByteChannel channel)
          Makes an attempt to flush the content of this buffer to the given destination WritableByteChannel.
 void reset(HttpParams params)
           
 void write(ByteBuffer src)
          Copies content of the source buffer into this buffer.
 void write(ReadableByteChannel src)
          Reads a sequence of bytes from the source channel into this buffer.
 void writeLine(CharArrayBuffer linebuffer)
          Copies content of the source buffer into this buffer as one line of text including a line delimiter.
 void writeLine(String s)
          Copies content of the given string into this buffer as one line of text including a line delimiter.
 
Methods inherited from class org.apache.http.nio.util.ExpandableBuffer
available, capacity, clear, ensureCapacity, expand, getMode, hasData, length, setInputMode, setOutputMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.http.nio.reactor.SessionOutputBuffer
hasData, length
 

Constructor Detail

SessionOutputBufferImpl

public SessionOutputBufferImpl(int buffersize,
                               int lineBuffersize,
                               CharsetEncoder charencoder,
                               ByteBufferAllocator allocator)
Creates SessionOutputBufferImpl instance.

Parameters:
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.
Since:
4.3

SessionOutputBufferImpl

@Deprecated
public SessionOutputBufferImpl(int buffersize,
                                          int lineBuffersize,
                                          ByteBufferAllocator allocator,
                                          HttpParams params)
Deprecated. (4.3) use SessionOutputBufferImpl(int, int, CharsetEncoder, ByteBufferAllocator)


SessionOutputBufferImpl

@Deprecated
public SessionOutputBufferImpl(int buffersize,
                                          int linebuffersize,
                                          HttpParams params)
Deprecated. (4.3) use SessionOutputBufferImpl(int, int, Charset)


SessionOutputBufferImpl

public SessionOutputBufferImpl(int buffersize)
Since:
4.3

SessionOutputBufferImpl

public SessionOutputBufferImpl(int buffersize,
                               int linebuffersize,
                               Charset charset)
Since:
4.3

SessionOutputBufferImpl

public SessionOutputBufferImpl(int buffersize,
                               int linebuffersize)
Since:
4.3
Method Detail

reset

public void reset(HttpParams params)

flush

public int flush(WritableByteChannel channel)
          throws IOException
Description copied from interface: SessionOutputBuffer
Makes an attempt to flush the content of this buffer to the given destination WritableByteChannel.

Specified by:
flush in interface SessionOutputBuffer
Parameters:
channel - the destination channel.
Returns:
The number of bytes written, possibly zero.
Throws:
IOException - in case of an I/O error.

write

public void write(ByteBuffer src)
Description copied from interface: SessionOutputBuffer
Copies content of the source buffer into this buffer. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.

Specified by:
write in interface SessionOutputBuffer
Parameters:
src - the source buffer.

write

public void write(ReadableByteChannel src)
           throws IOException
Description copied from interface: SessionOutputBuffer
Reads a sequence of bytes from the source channel into this buffer.

Specified by:
write in interface SessionOutputBuffer
Parameters:
src - the source channel.
Throws:
IOException

writeLine

public void writeLine(CharArrayBuffer linebuffer)
               throws CharacterCodingException
Description copied from interface: SessionOutputBuffer
Copies content of the source buffer into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.

The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.

Specified by:
writeLine in interface SessionOutputBuffer
Parameters:
linebuffer - the source buffer.
Throws:
CharacterCodingException

writeLine

public void writeLine(String s)
               throws IOException
Description copied from interface: SessionOutputBuffer
Copies content of the given string into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire string.

The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.

Specified by:
writeLine in interface SessionOutputBuffer
Parameters:
s - the string.
Throws:
IOException


Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.