org.fusesource.fabric.dosgi.io
Interface ProtocolCodec

All Known Implementing Classes:
LengthPrefixedCodec

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()
           
 long getReadCounter()
           
 long getWriteCounter()
           
 java.lang.Object read()
          Non-blocking channel based decoding.
 void setReadableByteChannel(java.nio.channels.ReadableByteChannel channel)
           
 void setWritableByteChannel(java.nio.channels.WritableByteChannel channel)
           
 ProtocolCodec.BufferState write(java.lang.Object value)
          Non-blocking channel based encoding.
 

Method Detail

setReadableByteChannel

void setReadableByteChannel(java.nio.channels.ReadableByteChannel channel)
Parameters:
channel -

read

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

Returns:
Throws:
java.io.IOException

getReadCounter

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

setWritableByteChannel

void setWritableByteChannel(java.nio.channels.WritableByteChannel channel)

write

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

Returns:
true if the write completed.
Throws:
java.io.IOException

flush

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

Returns:
Throws:
java.io.IOException

full

boolean full()
Returns:
true if the codec will no accept any more writes.

getWriteCounter

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


Copyright © 2013 Red Hat. All Rights Reserved.