Package fr.dyade.aaa.common.encoding
Class EncodedString
- java.lang.Object
-
- fr.dyade.aaa.common.encoding.EncodedString
-
- All Implemented Interfaces:
Encodable,Serializable
public final class EncodedString extends Object implements Serializable, Encodable
Encodable object that wraps a string. It also serves as a cache for the encoded string.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEncodedString.Factory
-
Field Summary
Fields Modifier and Type Field Description private byte[]encodedStringprivate Stringstring-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description EncodedString()EncodedString(String string)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecode(Decoder decoder)Decodes the content of this objectvoidencode(Encoder encoder)Encodes the content of this objectbooleanequals(Object obj)intgetEncodableClassId()Returns a unique class identifier.intgetEncodedSize()Returns the size of the byte array that results from the encoding of this object.StringgetString()inthashCode()voidreadFrom(DataInputStream is)private voidreadObject(ObjectInputStream in)StringtoString()private voidwriteObject(ObjectOutputStream out)voidwriteTo(DataOutputStream os)
-
-
-
Field Detail
-
string
private String string
-
encodedString
private byte[] encodedString
-
-
Constructor Detail
-
EncodedString
public EncodedString()
-
EncodedString
public EncodedString(String string)
-
-
Method Detail
-
getString
public String getString()
-
writeTo
public void writeTo(DataOutputStream os) throws IOException
- Throws:
IOException
-
readFrom
public void readFrom(DataInputStream is) throws IOException
- Throws:
IOException
-
writeObject
private void writeObject(ObjectOutputStream out) throws IOException
- Throws:
IOException
-
readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
getEncodableClassId
public int getEncodableClassId()
Description copied from interface:EncodableReturns a unique class identifier.- Specified by:
getEncodableClassIdin interfaceEncodable- Returns:
- a unique class identifier
-
getEncodedSize
public int getEncodedSize()
Description copied from interface:EncodableReturns the size of the byte array that results from the encoding of this object.- Specified by:
getEncodedSizein interfaceEncodable- Returns:
- the size of the encoded byte array
-
encode
public void encode(Encoder encoder) throws Exception
Description copied from interface:EncodableEncodes the content of this object
-
-