org.fusesource.hawtbuf.codec
Class IntegerCodec

java.lang.Object
  extended by org.fusesource.hawtbuf.codec.IntegerCodec
All Implemented Interfaces:
Codec<Integer>

public class IntegerCodec
extends Object
implements Codec<Integer>

Implementation of a Marshaller for a Integer


Field Summary
static IntegerCodec INSTANCE
           
 
Constructor Summary
IntegerCodec()
           
 
Method Summary
 Integer decode(DataInput dataIn)
          Read the payload of the object from the DataInput stream.
 Integer deepCopy(Integer source)
           
 void encode(Integer object, DataOutput dataOut)
          Write the payload of the object to the DataOutput stream.
 int estimatedSize(Integer object)
           
 int getFixedSize()
           
 boolean isDeepCopySupported()
           
 boolean isEstimatedSizeSupported()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final IntegerCodec INSTANCE
Constructor Detail

IntegerCodec

public IntegerCodec()
Method Detail

encode

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

Specified by:
encode in interface Codec<Integer>
Throws:
IOException

decode

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

Specified by:
decode in interface Codec<Integer>
Returns:
unmarshalled object
Throws:
IOException

getFixedSize

public int getFixedSize()
Specified by:
getFixedSize in interface Codec<Integer>
Returns:
-1 if the object do not always marshall to a fixed size, otherwise return that fixed size.

deepCopy

public Integer deepCopy(Integer source)
Specified by:
deepCopy in interface Codec<Integer>
Returns:
the source object since integers are immutable.

isDeepCopySupported

public boolean isDeepCopySupported()
Specified by:
isDeepCopySupported in interface Codec<Integer>
Returns:
true if the Codec.deepCopy(Object) operations is supported.

isEstimatedSizeSupported

public boolean isEstimatedSizeSupported()
Specified by:
isEstimatedSizeSupported in interface Codec<Integer>
Returns:
true if the Codec.estimatedSize(Object) operation is supported.

estimatedSize

public int estimatedSize(Integer object)
Specified by:
estimatedSize in interface Codec<Integer>
Returns:
the estimated marshaled size of the object.


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