org.fusesource.fabric.dosgi.tcp
Class LengthPrefixedCodec

java.lang.Object
  extended by org.fusesource.fabric.dosgi.tcp.LengthPrefixedCodec
All Implemented Interfaces:
ProtocolCodec

public class LengthPrefixedCodec
extends java.lang.Object
implements ProtocolCodec


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fusesource.fabric.dosgi.io.ProtocolCodec
ProtocolCodec.BufferState
 
Constructor Summary
LengthPrefixedCodec()
           
 
Method Summary
protected  boolean empty()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LengthPrefixedCodec

public LengthPrefixedCodec()
Method Detail

full

public boolean full()
Specified by:
full in interface ProtocolCodec
Returns:
true if the codec will no accept any more writes.

empty

protected boolean empty()

setWritableByteChannel

public void setWritableByteChannel(java.nio.channels.WritableByteChannel channel)
Specified by:
setWritableByteChannel in interface ProtocolCodec

write

public ProtocolCodec.BufferState write(java.lang.Object value)
                                throws java.io.IOException
Description copied from interface: ProtocolCodec
Non-blocking channel based encoding.

Specified by:
write in interface ProtocolCodec
Returns:
true if the write completed.
Throws:
java.io.IOException

flush

public ProtocolCodec.BufferState flush()
                                throws java.io.IOException
Description copied from interface: ProtocolCodec
Attempts to complete the previous write which did not complete.

Specified by:
flush in interface ProtocolCodec
Returns:
Throws:
java.io.IOException

getWriteCounter

public long getWriteCounter()
Specified by:
getWriteCounter in interface ProtocolCodec
Returns:
The number of bytes written.

setReadableByteChannel

public void setReadableByteChannel(java.nio.channels.ReadableByteChannel channel)
Specified by:
setReadableByteChannel in interface ProtocolCodec

read

public java.lang.Object read()
                      throws java.io.IOException
Description copied from interface: ProtocolCodec
Non-blocking channel based decoding.

Specified by:
read in interface ProtocolCodec
Returns:
Throws:
java.io.IOException

getReadCounter

public long getReadCounter()
Specified by:
getReadCounter in interface ProtocolCodec
Returns:
The number of bytes received.


Copyright © 2013 Red Hat. All Rights Reserved.