org.fusesource.hawtbuf.codec
Class VarLongCodec

java.lang.Object
  extended by org.fusesource.hawtbuf.codec.VarLongCodec
All Implemented Interfaces:
Codec<Long>
Direct Known Subclasses:
VarSignedLongCodec

public class VarLongCodec
extends Object
implements Codec<Long>

Implementation of a variable length Codec for a Long


Field Summary
static VarLongCodec INSTANCE
           
 
Constructor Summary
VarLongCodec()
           
 
Method Summary
 Long decode(DataInput dataIn)
          Read the payload of the object from the DataInput stream.
 Long deepCopy(Long source)
           
 void encode(Long object, DataOutput dataOut)
          Write the payload of the object to the DataOutput stream.
 int estimatedSize(Long 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 VarLongCodec INSTANCE
Constructor Detail

VarLongCodec

public VarLongCodec()
Method Detail

encode

public void encode(Long 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<Long>
Throws:
IOException

decode

public Long 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<Long>
Returns:
unmarshalled object
Throws:
IOException

isEstimatedSizeSupported

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

estimatedSize

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

getFixedSize

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

deepCopy

public Long deepCopy(Long source)
Specified by:
deepCopy in interface Codec<Long>
Returns:
a deep copy of the source object. If the source is immutable the same source should be returned.

isDeepCopySupported

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


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