public abstract class AbstractSerializationStreamWriter extends AbstractSerializationStream implements SerializationStreamWriter
DEFAULT_FLAGS, FLAG_ELIDE_TYPE_NAMES, FLAG_RPC_TOKEN_INCLUDED, RPC_SEPARATOR_CHAR, SERIALIZATION_STREAM_MIN_VERSION, SERIALIZATION_STREAM_VERSION, VALID_FLAGS_MASK
Constructor and Description |
---|
AbstractSerializationStreamWriter() |
Modifier and Type | Method and Description |
---|---|
protected int |
addString(String string)
Add a string to the string table and return its index.
|
protected abstract void |
append(String token)
Append a token to the underlying output buffer.
|
static double[] |
getAsDoubleArray(long value)
Return a pair of doubles { low, high } that add up to the given number,
such that "low" is always between 0 and 2^32-1 inclusive and "high" is
always between -2^63 and 2^63-2^32 inclusive and is a multiple of 2^32.
|
protected int |
getIndexForObject(Object instance)
Get the index for an object that may have previously been saved via
saveIndexForObject(Object) . |
protected abstract String |
getObjectTypeSignature(Object instance)
Compute and return the type signature for an object.
|
protected List<String> |
getStringTable()
Gets the string table.
|
protected static double[] |
makeLongComponents(int lowBits,
int highBits) |
void |
prepareToWrite() |
protected void |
saveIndexForObject(Object instance)
Remember this object as having been seen before.
|
protected abstract void |
serialize(Object instance,
String typeSignature)
Serialize an object into the stream.
|
abstract String |
toString()
Serializes the contents of this stream into a string.
|
void |
writeBoolean(boolean fieldValue) |
void |
writeByte(byte fieldValue) |
void |
writeChar(char ch) |
void |
writeDouble(double fieldValue) |
void |
writeFloat(float fieldValue) |
void |
writeInt(int fieldValue) |
abstract void |
writeLong(long value) |
void |
writeObject(Object instance) |
void |
writeShort(short value) |
void |
writeString(String value) |
addFlags, areFlagsValid, getFlags, getVersion, hasFlags, setFlags, setVersion
public static double[] getAsDoubleArray(long value)
protected static double[] makeLongComponents(int lowBits, int highBits)
public void prepareToWrite()
public abstract String toString()
SerializationStreamWriter
toString
in interface SerializationStreamWriter
toString
in class Object
public void writeBoolean(boolean fieldValue)
writeBoolean
in interface SerializationStreamWriter
public void writeByte(byte fieldValue)
writeByte
in interface SerializationStreamWriter
public void writeChar(char ch)
writeChar
in interface SerializationStreamWriter
public void writeDouble(double fieldValue)
writeDouble
in interface SerializationStreamWriter
public void writeFloat(float fieldValue)
writeFloat
in interface SerializationStreamWriter
public void writeInt(int fieldValue)
writeInt
in interface SerializationStreamWriter
public abstract void writeLong(long value)
writeLong
in interface SerializationStreamWriter
public void writeObject(Object instance) throws SerializationException
writeObject
in interface SerializationStreamWriter
SerializationException
public void writeShort(short value)
writeShort
in interface SerializationStreamWriter
public void writeString(String value)
writeString
in interface SerializationStreamWriter
protected int addString(String string)
string
- the string to addprotected abstract void append(String token)
token
- the token to appendprotected int getIndexForObject(Object instance)
saveIndexForObject(Object)
.instance
- the object to saveprotected abstract String getObjectTypeSignature(Object instance) throws SerializationException
instance
- the instance to inspectSerializationException
protected void saveIndexForObject(Object instance)
instance
- the object to rememberprotected abstract void serialize(Object instance, String typeSignature) throws SerializationException
instance
- the object to serializetypeSignature
- the type signature of the objectSerializationException
Copyright © 2018. All rights reserved.