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 ProtocolCodec
public int getReadBufferSize()
getReadBufferSize
in interface ProtocolCodec
public int getWriteBufferSize()
getWriteBufferSize
in interface ProtocolCodec
public boolean full()
ProtocolCodec
full
in interface ProtocolCodec
public boolean isEmpty()
public long getWriteCounter()
getWriteCounter
in interface ProtocolCodec
public 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 ProtocolCodec
IOException
protected void writeDirect(ByteBuffer value) throws IOException
IOException
protected void flushNextWriteBuffer()
public ProtocolCodec.BufferState flush() throws IOException
ProtocolCodec
flush
in interface ProtocolCodec
IOException
protected void onBufferFlushed(ByteBuffer byteBuffer)
byteBuffer
- protected abstract AbstractProtocolCodec.Action initialDecodeAction()
public void unread(byte[] buffer)
ProtocolCodec
unread
in interface ProtocolCodec
public long getReadCounter()
getReadCounter
in interface ProtocolCodec
public long getLastReadSize()
getLastReadSize
in interface ProtocolCodec
public Object read() throws IOException
ProtocolCodec
read
in interface ProtocolCodec
IOException
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
ProtocolException
protected 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–2017 FuseSource, Corp.. All rights reserved.