org.fusesource.hawtbuf.proto
Class PBMessageUnframedCodec<T extends MessageBuffer>

java.lang.Object
  extended by org.fusesource.hawtbuf.codec.VariableCodec<T>
      extended by org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<T>
All Implemented Interfaces:
Codec<T>

public class PBMessageUnframedCodec<T extends MessageBuffer>
extends VariableCodec<T>

Implements the Codec interface for PBMessages type which encode/decodes unframed messages.

Author:
Hiram Chirino

Constructor Summary
PBMessageUnframedCodec(PBMessageFactory<?,? extends T> factory)
           
 
Method Summary
 T decode(java.io.DataInput dataIn)
          Read the payload of the object from the DataInput stream.
 T deepCopy(T value)
           
 void encode(T value, java.io.DataOutput dataOut)
          Write the payload of the object to the DataOutput stream.
 int estimatedSize(T value)
           
 boolean isDeepCopySupported()
           
 boolean isEstimatedSizeSupported()
           
 
Methods inherited from class org.fusesource.hawtbuf.codec.VariableCodec
getFixedSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBMessageUnframedCodec

public PBMessageUnframedCodec(PBMessageFactory<?,? extends T> factory)
Method Detail

decode

public T decode(java.io.DataInput dataIn)
                               throws java.io.IOException
Description copied from interface: Codec
Read the payload of the object from the DataInput stream.

Returns:
unmarshalled object
Throws:
java.io.IOException

encode

public void encode(T value,
                   java.io.DataOutput dataOut)
            throws java.io.IOException
Description copied from interface: Codec
Write the payload of the object to the DataOutput stream.

Throws:
java.io.IOException

isEstimatedSizeSupported

public boolean isEstimatedSizeSupported()
Specified by:
isEstimatedSizeSupported in interface Codec<T extends MessageBuffer>
Overrides:
isEstimatedSizeSupported in class VariableCodec<T extends MessageBuffer>
Returns:
true if the Codec.estimatedSize(Object) operation is supported.

estimatedSize

public int estimatedSize(T value)
Specified by:
estimatedSize in interface Codec<T extends MessageBuffer>
Overrides:
estimatedSize in class VariableCodec<T extends MessageBuffer>
Returns:
the estimated marshaled size of the object.

isDeepCopySupported

public boolean isDeepCopySupported()
Specified by:
isDeepCopySupported in interface Codec<T extends MessageBuffer>
Overrides:
isDeepCopySupported in class VariableCodec<T extends MessageBuffer>
Returns:
true if the Codec.deepCopy(Object) operations is supported.

deepCopy

public T deepCopy(T value)
Specified by:
deepCopy in interface Codec<T extends MessageBuffer>
Overrides:
deepCopy in class VariableCodec<T extends MessageBuffer>
Returns:
a deep copy of the source object. If the source is immutable the same source should be returned.


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