|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fusesource.hawtdispatch.transport.AbstractProtocolCodec
public abstract class AbstractProtocolCodec
Provides an abstract base class to make implementing the ProtocolCodec interface easier.
| Nested Class Summary | |
|---|---|
static interface |
AbstractProtocolCodec.Action
|
| Nested classes/interfaces inherited from interface org.fusesource.hawtdispatch.transport.ProtocolCodec |
|---|
ProtocolCodec.BufferState |
| Field Summary | |
|---|---|
protected ByteBuffer |
directReadBuffer
|
protected int |
lastReadIoSize
|
protected long |
lastWriteIoSize
|
protected AbstractProtocolCodec.Action |
nextDecodeAction
|
protected org.fusesource.hawtbuf.DataByteArrayOutputStream |
nextWriteBuffer
|
protected ByteBuffer |
readBuffer
|
protected int |
readBufferSize
|
protected ReadableByteChannel |
readChannel
|
protected long |
readCounter
|
protected int |
readEnd
|
protected int |
readStart
|
protected boolean |
trim
|
protected LinkedList<ByteBuffer> |
writeBuffer
|
protected int |
writeBufferSize
|
protected GatheringByteChannel |
writeChannel
|
protected long |
writeCounter
|
| Constructor Summary | |
|---|---|
AbstractProtocolCodec()
|
|
| Method Summary | |
|---|---|
protected abstract void |
encode(Object value)
|
ProtocolCodec.BufferState |
flush()
Attempts to complete the previous write which did not complete. |
protected void |
flushNextWriteBuffer()
|
boolean |
full()
Is the codec's buffer full? |
long |
getLastReadSize()
|
long |
getLastWriteSize()
|
int |
getReadBufferSize()
|
long |
getReadCounter()
|
int |
getWriteBufferSize()
|
long |
getWriteCounter()
|
protected abstract AbstractProtocolCodec.Action |
initialDecodeAction()
|
boolean |
isEmpty()
|
protected void |
onBufferFlushed(ByteBuffer byteBuffer)
Called when a buffer is flushed out. |
protected org.fusesource.hawtbuf.Buffer |
peekBytes(int length)
|
Object |
read()
Non-blocking channel based decoding. |
protected org.fusesource.hawtbuf.Buffer |
readBytes(int length)
|
protected Boolean |
readDirect(ByteBuffer buffer)
|
protected org.fusesource.hawtbuf.Buffer |
readUntil(Byte octet)
|
protected org.fusesource.hawtbuf.Buffer |
readUntil(Byte octet,
int max)
|
protected org.fusesource.hawtbuf.Buffer |
readUntil(Byte octet,
int max,
String msg)
|
void |
setReadableByteChannel(ReadableByteChannel channel)
|
void |
setWritableByteChannel(WritableByteChannel channel)
|
void |
unread(byte[] buffer)
Pushes back a buffer as being unread. |
ProtocolCodec.BufferState |
write(Object value)
Non-blocking channel based encoding. |
protected void |
writeDirect(ByteBuffer value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int writeBufferSize
protected long writeCounter
protected GatheringByteChannel writeChannel
protected org.fusesource.hawtbuf.DataByteArrayOutputStream nextWriteBuffer
protected long lastWriteIoSize
protected LinkedList<ByteBuffer> writeBuffer
protected long readCounter
protected int readBufferSize
protected ReadableByteChannel readChannel
protected ByteBuffer readBuffer
protected ByteBuffer directReadBuffer
protected int readEnd
protected int readStart
protected int lastReadIoSize
protected AbstractProtocolCodec.Action nextDecodeAction
protected boolean trim
| Constructor Detail |
|---|
public AbstractProtocolCodec()
| Method Detail |
|---|
public void setWritableByteChannel(WritableByteChannel channel)
throws SocketException
setWritableByteChannel in interface ProtocolCodecSocketExceptionpublic int getReadBufferSize()
getReadBufferSize in interface ProtocolCodecpublic int getWriteBufferSize()
getWriteBufferSize in interface ProtocolCodecpublic boolean full()
ProtocolCodec
full in interface ProtocolCodecpublic boolean isEmpty()
public long getWriteCounter()
getWriteCounter in interface ProtocolCodecpublic long getLastWriteSize()
getLastWriteSize in interface ProtocolCodec
protected abstract void encode(Object value)
throws IOException
IOException
public ProtocolCodec.BufferState write(Object value)
throws IOException
ProtocolCodec
write in interface ProtocolCodecIOException
protected void writeDirect(ByteBuffer value)
throws IOException
IOExceptionprotected void flushNextWriteBuffer()
public ProtocolCodec.BufferState flush()
throws IOException
ProtocolCodec
flush in interface ProtocolCodecIOExceptionprotected void onBufferFlushed(ByteBuffer byteBuffer)
byteBuffer - protected abstract AbstractProtocolCodec.Action initialDecodeAction()
public void setReadableByteChannel(ReadableByteChannel channel)
throws SocketException
setReadableByteChannel in interface ProtocolCodecSocketExceptionpublic void unread(byte[] buffer)
ProtocolCodec
unread in interface ProtocolCodecpublic long getReadCounter()
getReadCounter in interface ProtocolCodecpublic long getLastReadSize()
getLastReadSize in interface ProtocolCodec
public Object read()
throws IOException
ProtocolCodec
read in interface ProtocolCodecIOException
protected org.fusesource.hawtbuf.Buffer readUntil(Byte octet)
throws ProtocolException
ProtocolException
protected org.fusesource.hawtbuf.Buffer readUntil(Byte octet,
int max)
throws ProtocolException
ProtocolException
protected org.fusesource.hawtbuf.Buffer readUntil(Byte octet,
int max,
String msg)
throws ProtocolException
ProtocolExceptionprotected org.fusesource.hawtbuf.Buffer readBytes(int length)
protected org.fusesource.hawtbuf.Buffer peekBytes(int length)
protected Boolean readDirect(ByteBuffer buffer)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||