org.fusesource.hawtbuf.codec
Class StringCodec
java.lang.Object
org.fusesource.hawtbuf.codec.StringCodec
- All Implemented Interfaces:
- Codec<String>
public class StringCodec
- extends Object
- implements Codec<String>
Implementation of a Marshaller for Strings
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final StringCodec INSTANCE
StringCodec
public StringCodec()
encode
public void encode(String object,
DataOutput dataOut)
throws IOException
- Write the payload of this entry to the RawContainer
- Specified by:
encode
in interface Codec<String>
- Parameters:
object
- dataOut
-
- Throws:
IOException
decode
public String decode(DataInput dataIn)
throws IOException
- Read the entry from the RawContainer
- Specified by:
decode
in interface Codec<String>
- Parameters:
dataIn
-
- Returns:
- unmarshalled object
- Throws:
IOException
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSize
in interface Codec<String>
- Returns:
- -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
deepCopy
public String deepCopy(String source)
- Specified by:
deepCopy
in interface Codec<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<String>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interface Codec<String>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
estimatedSize
public int estimatedSize(String object)
- Specified by:
estimatedSize
in interface Codec<String>
- Returns:
- the estimated marshaled size of the object.
Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.