|
TopoWeb Commons API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.topoweb.net.server.PlainSession
A minimal implementation of the Session
interface.
This implementation comes with its own trivial SessionPool
implementation.
getFactory()
Constructor Summary | |
protected |
PlainSession()
|
|
PlainSession(java.nio.channels.SocketChannel channel)
Creates an instance with the specified socket channel . |
Method Summary | |
void |
appendReadBuffer(java.nio.ByteBuffer buffer)
Append the given buffer into this instance's
internal "read buffer". |
protected void |
clear()
Clears the fields of this instance. |
static SessionPool |
getFactory()
Returns a trivial pool that returns PlainSession
instances and doesn't do any caching. |
int |
getReadAmount()
Returns the content-length of the internal "read buffer". |
byte[] |
getReadArray()
Returns the internal "read buffer". |
java.nio.channels.SocketChannel |
getSocketChannel()
Returns the socket channel used by this session. |
java.nio.ByteBuffer[] |
getWriteBuffers()
Returns the "write buffers". |
protected void |
setSocketChannel(java.nio.channels.SocketChannel channel)
Sets the socket channel . |
void |
setWriteBuffers(java.nio.ByteBuffer[] buffers)
Sets the "write buffers". |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected PlainSession()
public PlainSession(java.nio.channels.SocketChannel channel)
channel
.
channel
- the SocketChannel
returned by the
getSocketChannel
method
java.lang.IllegalArgumentException
- if channel
is null
Method Detail |
public static SessionPool getFactory()
PlainSession
instances and doesn't do any caching.
SessionPool
instance.public java.nio.channels.SocketChannel getSocketChannel()
Session
getSocketChannel
in interface Session
public void appendReadBuffer(java.nio.ByteBuffer buffer)
Session
buffer
into this instance's
internal "read buffer". The "read amount" is incremented by
the buffer.remaining()
.
appendReadBuffer
in interface Session
buffer
- the buffer whose contents are appendedSession.getReadArray()
,
Session.getReadAmount()
public byte[] getReadArray()
Session
getReadAmount()
method.
getReadArray
in interface Session
Session.appendReadBuffer(ByteBuffer)
,
Session.getReadAmount()
public int getReadAmount()
Session
getReadAmount
in interface Session
Session.appendReadBuffer(ByteBuffer)
,
Session.getReadArray()
public void setWriteBuffers(java.nio.ByteBuffer[] buffers)
Session
buffers
are
to be written out to the client.
setWriteBuffers
in interface Session
buffers
- the write buffersSession.getWriteBuffers()
public java.nio.ByteBuffer[] getWriteBuffers()
Session
getWriteBuffers
in interface Session
Session.setWriteBuffers(ByteBuffer[])
protected void clear()
protected void setSocketChannel(java.nio.channels.SocketChannel channel)
channel
.
channel
- the new channel for which this instance
encapsulates conversational state.
java.lang.IllegalArgumentException
- if channel
is null
getSocketChannel()
|
TopoWeb Commons API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |