com.google.gwt.user.server.rpc.impl
Class ServerSerializationStreamWriter

java.lang.Object
  extended by com.google.gwt.user.client.rpc.impl.AbstractSerializationStream
      extended by com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter
          extended by com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
All Implemented Interfaces:
SerializationStreamWriter

public final class ServerSerializationStreamWriter
extends AbstractSerializationStreamWriter

For internal use only. Used for server call serialization. This class is carefully matched with the client-side version.


Nested Class Summary
static class ServerSerializationStreamWriter.LengthConstrainedArray
          Builds a string that evaluates into an array containing the given elements.
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.rpc.impl.AbstractSerializationStream
DEFAULT_FLAGS, FLAG_ELIDE_TYPE_NAMES, RPC_SEPARATOR_CHAR, SERIALIZATION_STREAM_MIN_VERSION, SERIALIZATION_STREAM_VERSION
 
Constructor Summary
ServerSerializationStreamWriter(SerializationPolicy serializationPolicy)
           
 
Method Summary
static java.lang.String escapeString(java.lang.String toEscape)
          This method takes a string and outputs a JavaScript string literal.
 void prepareToWrite()
           
 void serializeValue(java.lang.Object value, java.lang.Class<?> type)
           
 java.lang.String toString()
          Build an array of JavaScript string literals that can be decoded by the client via the eval function.
 void writeLong(long value)
           
 
Methods inherited from class com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter
getAsDoubleArray, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeObject, writeShort, writeString
 
Methods inherited from class com.google.gwt.user.client.rpc.impl.AbstractSerializationStream
addFlags, getFlags, getVersion, hasFlags, setFlags
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerSerializationStreamWriter

public ServerSerializationStreamWriter(SerializationPolicy serializationPolicy)
Method Detail

escapeString

public static java.lang.String escapeString(java.lang.String toEscape)
This method takes a string and outputs a JavaScript string literal. The data is surrounded with quotes, and any contained characters that need to be escaped are mapped onto their escape sequence. Assumptions: We are targeting a version of JavaScript that that is later than 1.3 that supports unicode strings.


prepareToWrite

public void prepareToWrite()
Overrides:
prepareToWrite in class AbstractSerializationStreamWriter

serializeValue

public void serializeValue(java.lang.Object value,
                           java.lang.Class<?> type)
                    throws SerializationException
Throws:
SerializationException

toString

public java.lang.String toString()
Build an array of JavaScript string literals that can be decoded by the client via the eval function. NOTE: We build the array in reverse so the client can simply use the pop function to remove the next item from the list.

Specified by:
toString in interface SerializationStreamWriter
Specified by:
toString in class AbstractSerializationStreamWriter
Returns:
a string that is the serialization of the contents of this stream

writeLong

public void writeLong(long value)
Specified by:
writeLong in interface SerializationStreamWriter
Specified by:
writeLong in class AbstractSerializationStreamWriter