org.fusesource.hawtdispatch.transport
Interface ProtocolCodec

All Known Subinterfaces:
WrappingProtocolCodec
All Known Implementing Classes:
AbstractProtocolCodec, SslProtocolCodec

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 setTransport(Transport transport)
           
 void unread(byte[] buffer)
          Pushes back a buffer as being unread.
 ProtocolCodec.BufferState write(Object value)
          Non-blocking channel based encoding.
 

Method Detail

setTransport

void setTransport(Transport transport)

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.

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-2014 FuseSource, Corp.. All Rights Reserved.