public final class ServerSerializationStreamWriter extends AbstractSerializationStreamWriter
Modifier and Type | Class and Description |
---|---|
static class |
ServerSerializationStreamWriter.LengthConstrainedArray
Builds a string that evaluates into an array containing the given elements.
|
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 |
---|
ServerSerializationStreamWriter(SerializationPolicy serializationPolicy) |
Modifier and Type | Method and Description |
---|---|
protected void |
append(String token)
Append a token to the underlying output buffer.
|
static String |
escapeString(String toEscape)
This method takes a string and outputs a JavaScript string literal.
|
static String |
escapeStringSplitNodes(String toEscape)
This method takes a string and outputs a JavaScript string literal.
|
protected String |
getObjectTypeSignature(Object instance)
Compute and return the type signature for an object.
|
void |
prepareToWrite() |
protected void |
serialize(Object instance,
String typeSignature)
Serialize an object into the stream.
|
void |
serializeValue(Object value,
Class<?> type) |
String |
toString()
Build an array of JavaScript string literals that can be decoded by the
client via the eval function.
|
void |
writeLong(long value) |
addString, getAsDoubleArray, getIndexForObject, getStringTable, makeLongComponents, saveIndexForObject, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeObject, writeShort, writeString
addFlags, areFlagsValid, getFlags, getVersion, hasFlags, setFlags, setVersion
public ServerSerializationStreamWriter(SerializationPolicy serializationPolicy)
public static String escapeString(String toEscape)
public static String escapeStringSplitNodes(String toEscape)
"longstring"
is
converted to "long" + "string"
.
Assumptions: We are targeting a version of JavaScript that that is later
than 1.3 that supports unicode strings.public void prepareToWrite()
prepareToWrite
in class AbstractSerializationStreamWriter
public void serializeValue(Object value, Class<?> type) throws SerializationException
SerializationException
public String toString()
toString
in interface SerializationStreamWriter
toString
in class AbstractSerializationStreamWriter
public void writeLong(long value)
writeLong
in interface SerializationStreamWriter
writeLong
in class AbstractSerializationStreamWriter
protected void append(String token)
AbstractSerializationStreamWriter
append
in class AbstractSerializationStreamWriter
token
- the token to appendprotected String getObjectTypeSignature(Object instance) throws SerializationException
AbstractSerializationStreamWriter
getObjectTypeSignature
in class AbstractSerializationStreamWriter
instance
- the instance to inspectSerializationException
protected void serialize(Object instance, String typeSignature) throws SerializationException
AbstractSerializationStreamWriter
serialize
in class AbstractSerializationStreamWriter
instance
- the object to serializetypeSignature
- the type signature of the objectSerializationException
Copyright © 2018. All rights reserved.