org.fusesource.hawtdispatch.transport
Interface ProtocolCodec

All Known Implementing Classes:
AbstractProtocolCodec

public interface ProtocolCodec

Interface to encode and decode commands in and out of a a non blocking channel.

Author:
Hiram Chirino

Nested Class Summary
static class ProtocolCodec.BufferState
           
 
Method Summary
 ProtocolCodec.BufferState flush()
          Attempts to complete the previous write which did not complete.
 boolean full()
          Is the codec's buffer full?
 long getLastReadSize()
           
 long getLastWriteSize()
           
 int getReadBufferSize()
           
 long getReadCounter()
           
 int getWriteBufferSize()
           
 long getWriteCounter()
           
 Object read()
          Non-blocking channel based decoding.
 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.
 

Method Detail

setReadableByteChannel

void setReadableByteChannel(ReadableByteChannel channel)
                            throws Exception
Parameters:
channel -
Throws:
Exception

read

Object read()
            throws IOException
Non-blocking channel based decoding.

Returns:
Throws:
IOException

unread

void unread(byte[] buffer)
Pushes back a buffer as being unread.

Parameters:
buffer -

getReadCounter

long getReadCounter()
Returns:
The number of bytes received.

getLastReadSize

long getLastReadSize()
Returns:
The number of bytes read in the last read io performed.

setWritableByteChannel

void setWritableByteChannel(WritableByteChannel channel)
                            throws Exception
Throws:
Exception

getReadBufferSize

int getReadBufferSize()

getWriteBufferSize

int getWriteBufferSize()

write

ProtocolCodec.BufferState write(Object value)
                                throws IOException
Non-blocking channel based encoding.

Returns:
true if the write completed.
Throws:
IOException

flush

ProtocolCodec.BufferState flush()
                                throws IOException
Attempts to complete the previous write which did not complete.

Returns:
Throws:
IOException

full

boolean full()
Is the codec's buffer full?

Returns:

getWriteCounter

long getWriteCounter()
Returns:
The number of bytes written.

getLastWriteSize

long getLastWriteSize()
Returns:
The number of bytes read in the last write io performed.


Copyright © 2010-2012 FuseSource, Corp.. All Rights Reserved.