org.fusesource.hawtbuf.codec
Class StringCodec

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

public class StringCodec
extends java.lang.Object
implements Codec<java.lang.String>

Implementation of a Marshaller for Strings


Field Summary
static StringCodec INSTANCE
           
 
Constructor Summary
StringCodec()
           
 
Method Summary
 java.lang.String decode(java.io.DataInput dataIn)
          Read the entry from the RawContainer
 java.lang.String deepCopy(java.lang.String source)
           
 void encode(java.lang.String object, java.io.DataOutput dataOut)
          Write the payload of this entry to the RawContainer
 int estimatedSize(java.lang.String 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 StringCodec INSTANCE
Constructor Detail

StringCodec

public StringCodec()
Method Detail

encode

public void encode(java.lang.String object,
                   java.io.DataOutput dataOut)
            throws java.io.IOException
Write the payload of this entry to the RawContainer

Specified by:
encode in interface Codec<java.lang.String>
Parameters:
object -
dataOut -
Throws:
java.io.IOException

decode

public java.lang.String decode(java.io.DataInput dataIn)
                        throws java.io.IOException
Read the entry from the RawContainer

Specified by:
decode in interface Codec<java.lang.String>
Parameters:
dataIn -
Returns:
unmarshalled object
Throws:
java.io.IOException

getFixedSize

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

deepCopy

public java.lang.String deepCopy(java.lang.String source)
Specified by:
deepCopy in interface Codec<java.lang.String>
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<java.lang.String>
Returns:
true if the Codec.deepCopy(Object) operations is supported.

isEstimatedSizeSupported

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

estimatedSize

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


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