public abstract class AbstractProtocolCodec extends Object implements ProtocolCodec
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractProtocolCodec.Action |
ProtocolCodec.BufferState| Modifier and Type | Field and Description |
|---|---|
protected BufferPools |
bufferPools |
protected ByteBuffer |
directReadBuffer |
protected int |
lastReadIoSize |
protected long |
lastWriteIoSize |
protected AbstractProtocolCodec.Action |
nextDecodeAction |
protected org.fusesource.hawtbuf.DataByteArrayOutputStream |
nextWriteBuffer |
protected ByteBuffer |
readBuffer |
protected BufferPool |
readBufferPool |
protected int |
readBufferSize |
protected ReadableByteChannel |
readChannel |
protected long |
readCounter |
protected int |
readEnd |
protected int |
readStart |
protected LinkedList<ByteBuffer> |
writeBuffer |
protected BufferPool |
writeBufferPool |
protected int |
writeBufferSize |
protected GatheringByteChannel |
writeChannel |
protected long |
writeCounter |
| Constructor and Description |
|---|
AbstractProtocolCodec() |
| Modifier and Type | Method and Description |
|---|---|
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?
|
BufferPools |
getBufferPools() |
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 |
setBufferPools(BufferPools bufferPools) |
void |
setTransport(Transport transport) |
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) |
protected BufferPools bufferPools
protected BufferPool writeBufferPool
protected BufferPool readBufferPool
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
public AbstractProtocolCodec()
public void setTransport(Transport transport)
setTransport in interface ProtocolCodecpublic int getReadBufferSize()
getReadBufferSize in interface ProtocolCodecpublic int getWriteBufferSize()
getWriteBufferSize in interface ProtocolCodecpublic boolean full()
ProtocolCodecfull in interface ProtocolCodecpublic boolean isEmpty()
public long getWriteCounter()
getWriteCounter in interface ProtocolCodecpublic long getLastWriteSize()
getLastWriteSize in interface ProtocolCodecprotected abstract void encode(Object value) throws IOException
IOExceptionpublic ProtocolCodec.BufferState write(Object value) throws IOException
ProtocolCodecwrite in interface ProtocolCodecIOExceptionprotected void writeDirect(ByteBuffer value) throws IOException
IOExceptionprotected void flushNextWriteBuffer()
public ProtocolCodec.BufferState flush() throws IOException
ProtocolCodecflush in interface ProtocolCodecIOExceptionprotected void onBufferFlushed(ByteBuffer byteBuffer)
byteBuffer - protected abstract AbstractProtocolCodec.Action initialDecodeAction()
public void unread(byte[] buffer)
ProtocolCodecunread in interface ProtocolCodecpublic long getReadCounter()
getReadCounter in interface ProtocolCodecpublic long getLastReadSize()
getLastReadSize in interface ProtocolCodecpublic Object read() throws IOException
ProtocolCodecread in interface ProtocolCodecIOExceptionprotected org.fusesource.hawtbuf.Buffer readUntil(Byte octet) throws ProtocolException
ProtocolExceptionprotected org.fusesource.hawtbuf.Buffer readUntil(Byte octet, int max) throws ProtocolException
ProtocolExceptionprotected 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)
public BufferPools getBufferPools()
public void setBufferPools(BufferPools bufferPools)
Copyright © 2010-2013 FuseSource, Corp.. All Rights Reserved.