org.apache.activemq.apollo.transport
Class ObjectStreamProtocolCodec

java.lang.Object
  extended by org.apache.activemq.apollo.transport.ObjectStreamProtocolCodec
All Implemented Interfaces:
ProtocolCodec

public class ObjectStreamProtocolCodec
extends java.lang.Object
implements ProtocolCodec

A simple implementation which uses Object Stream serialization.

Version:
$Revision: 1.1 $

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.activemq.apollo.transport.ProtocolCodec
ProtocolCodec.BufferState
 
Field Summary
static java.lang.String WIREFORMAT_NAME
           
 
Constructor Summary
ObjectStreamProtocolCodec()
           
 
Method Summary
 ProtocolCodec.BufferState flush()
          Attempts to complete the previous write which did not complete.
 long getReadCounter()
           
 long getWriteCounter()
           
 org.fusesource.hawtbuf.Buffer marshal(java.lang.Object command)
           
 void marshal(java.lang.Object command, java.io.DataOutput ds)
           
 java.lang.String protocol()
           
 java.lang.Object read()
          Non-blocking channel based decoding.
 void setReadableByteChannel(java.nio.channels.ReadableByteChannel channel)
           
 void setWritableByteChannel(java.nio.channels.WritableByteChannel channel)
           
 java.lang.Object unmarshal(org.fusesource.hawtbuf.Buffer packet)
           
 java.lang.Object unmarshal(java.io.DataInput ds)
           
 void unread(org.fusesource.hawtbuf.Buffer buffer)
          Pushes back a buffer as being unread.
 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
 

Field Detail

WIREFORMAT_NAME

public static final java.lang.String WIREFORMAT_NAME
See Also:
Constant Field Values
Constructor Detail

ObjectStreamProtocolCodec

public ObjectStreamProtocolCodec()
Method Detail

marshal

public org.fusesource.hawtbuf.Buffer marshal(java.lang.Object command)
                                      throws java.io.IOException
Throws:
java.io.IOException

unmarshal

public java.lang.Object unmarshal(org.fusesource.hawtbuf.Buffer packet)
                           throws java.io.IOException
Throws:
java.io.IOException

marshal

public void marshal(java.lang.Object command,
                    java.io.DataOutput ds)
             throws java.io.IOException
Throws:
java.io.IOException

unmarshal

public java.lang.Object unmarshal(java.io.DataInput ds)
                           throws java.io.IOException
Throws:
java.io.IOException

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

unread

public void unread(org.fusesource.hawtbuf.Buffer buffer)
Description copied from interface: ProtocolCodec
Pushes back a buffer as being unread. The protocol discriminator may do this before before any reads occur.

Specified by:
unread in interface ProtocolCodec

getReadCounter

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

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.

protocol

public java.lang.String protocol()
Specified by:
protocol in interface ProtocolCodec
Returns:
The name of the protocol associated with the the channel codec.


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.