com.google.gwt.user.client.rpc
Class ClientSerializationStream

java.lang.Object
  extended bycom.google.gwt.user.client.rpc.SerializationStream
      extended bycom.google.gwt.user.client.rpc.ClientSerializationStream
All Implemented Interfaces:
SerializationStreamObjectDecoder, SerializationStreamObjectEncoder, SerializationStreamReader, SerializationStreamWriter, StringTable

public class ClientSerializationStream
extends SerializationStream

For internal use only. Used for server call serialization.


Field Summary
 
Fields inherited from class com.google.gwt.user.client.rpc.SerializationStream
flags, NEW_INSTANCE_MARKER, NULL_INSTANCE_MARKER, PREV_INSTANCE_MARKER, SERIALIZATION_STREAM_FLAGS_NO_TYPE_VERSIONING, SERIALIZATION_STREAM_VERSION, version
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
ClientSerializationStream(Serializer serializer)
           
 
Method Summary
 int addString(String typeName)
          Add a string to this string table.
 void append(String token)
          Appends a token to the end of the buffer.
protected  void clearSeenObjects()
          Clears the list of already-seen objects.
protected  void clearStringTable()
           
 void endInstance(SerializationStreamWriter streamWriter, Object instance)
          Mark the end of instance in the stream.
protected  JavaScriptObject evalArray(String encoded)
           
 String extract()
          Returns the next token in the decoded stream.
protected  void finalize()
          Never called.
protected  String getInstanceName(String token)
           
 SerializationStreamObjectDecoder getObjectDecoder()
           
 SerializationStreamObjectEncoder getObjectEncoder()
           
 String getString(int token)
          Get the string that is associated with the requested index.
 int getStringCount()
          Get the number of strings in the table.
 StringTable getStringTable()
          Get the string table associated with this decoder.
 Object lookupDecodedObject(String indexToken)
          Finds the already-decoded object associated with the given id.
 String nextInstance(SerializationStreamReader stream)
          Get's the binary name of the next instance in the serialization stream.
 void prepareToRead(String encoded)
          Call this method before attempting to extract any tokens.
 void prepareToWrite()
          Call this method before attempting to append any tokens.
 Object prevInstance(SerializationStreamReader stream)
          See if the next method in the stream is a previously seen method.
protected  int privLookupAndRememberAlreadyEncodedObject(Object o, int hashCode)
          Native helper for #encodeObjectPrelude.
 Object readObject()
           
 void rememberDecodedObject(Object o)
          Called during decode to allow an object to be coalesced Note that in this case, __seen is treated as an array.
 boolean startInstance(SerializationStreamWriter streamWriter, Object instance)
          Called during encode to encode a backref if the object has been seen before.
 String toString()
           
 void writeObject(Object instance)
           
 
Methods inherited from class com.google.gwt.user.client.rpc.SerializationStream
addFlags, getFlags, getVersion, readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readShort, setFlags, setVersion, shouldEnforceTypeVersioning, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeShort
 
Methods inherited from class java.lang.Object
equals, hashCode
 

Constructor Detail

ClientSerializationStream

public ClientSerializationStream(Serializer serializer)
Method Detail

append

public void append(String token)
Appends a token to the end of the buffer.

Specified by:
append in class SerializationStream

startInstance

public boolean startInstance(SerializationStreamWriter streamWriter,
                             Object instance)
Called during encode to encode a backref if the object has been seen before.

Returns:
true if the caller needs to encode the object (If o is non-null, never returns true twice).

endInstance

public void endInstance(SerializationStreamWriter streamWriter,
                        Object instance)
Description copied from interface: SerializationStreamObjectEncoder
Mark the end of instance in the stream.


extract

public String extract()
Returns the next token in the decoded stream. Do not call this method unless you know it will succeed, either because you have foreknowledge of the number of tokens (which is most efficient) or a call to ClientTokenBuffer#canExtract has just succeeded.

Specified by:
extract in class SerializationStream
Returns:
The next token in the stream as a String, or null if a token value is absent.

lookupDecodedObject

public Object lookupDecodedObject(String indexToken)
Finds the already-decoded object associated with the given id. Note that in this case, __seen is treated as an array.

Parameters:
indexToken - has leading '#'

evalArray

protected JavaScriptObject evalArray(String encoded)

prepareToRead

public void prepareToRead(String encoded)
Call this method before attempting to extract any tokens. This method implementation must be called by any overridden version.

Specified by:
prepareToRead in class SerializationStream

prepareToWrite

public void prepareToWrite()
Call this method before attempting to append any tokens. This method implementation must be called by any overridden version.

Specified by:
prepareToWrite in class SerializationStream

prevInstance

public Object prevInstance(SerializationStreamReader stream)
Description copied from interface: SerializationStreamObjectDecoder
See if the next method in the stream is a previously seen method. If it is then we return it. If not we return null.


nextInstance

public String nextInstance(SerializationStreamReader stream)
Description copied from interface: SerializationStreamObjectDecoder
Get's the binary name of the next instance in the serialization stream.


rememberDecodedObject

public void rememberDecodedObject(Object o)
Called during decode to allow an object to be coalesced Note that in this case, __seen is treated as an array.

Parameters:
o - - object that we want to be able to recall via prevInstance.

toString

public String toString()

clearSeenObjects

protected void clearSeenObjects()
Clears the list of already-seen objects. Note that __seen is used differently in the encode and decode cases. __seenCnt is only used for encode.


clearStringTable

protected void clearStringTable()

addString

public int addString(String typeName)
Description copied from interface: StringTable
Add a string to this string table. Returns the index assigned to this string in the table.

Parameters:
typeName -
Returns:
index of the string in the string table

getStringCount

public int getStringCount()
Description copied from interface: StringTable
Get the number of strings in the table.

Returns:
the number of strings in the string table.

getString

public String getString(int token)
Description copied from interface: StringTable
Get the string that is associated with the requested index.

Parameters:
token -
Returns:
String associated with the requested index

finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Never called.

Throws:
Throwable

privLookupAndRememberAlreadyEncodedObject

protected int privLookupAndRememberAlreadyEncodedObject(Object o,
                                                        int hashCode)
Native helper for #encodeObjectPrelude. If the object has been seen before, returns its index. If not, returns -1 and remembers the object in order. Note that in this case, __seen is treated as a map.

Parameters:
o - the object to be remembered.
hashCode - the result of calling System.identityHashCode(java.lang.Object) on o.

getObjectDecoder

public SerializationStreamObjectDecoder getObjectDecoder()
Specified by:
getObjectDecoder in interface SerializationStreamReader
Specified by:
getObjectDecoder in class SerializationStream

getObjectEncoder

public SerializationStreamObjectEncoder getObjectEncoder()
Specified by:
getObjectEncoder in interface SerializationStreamWriter
Specified by:
getObjectEncoder in class SerializationStream

getInstanceName

protected String getInstanceName(String token)

readObject

public Object readObject()
                  throws SerializationException
Throws:
SerializationException

writeObject

public void writeObject(Object instance)
                 throws SerializationException
Throws:
SerializationException

getStringTable

public StringTable getStringTable()
Description copied from interface: SerializationStreamObjectDecoder
Get the string table associated with this decoder.

Returns:


This javadoc distribution was not produced by Google. The official documentation is here.