1 16 package com.google.gwt.user.client.rpc.impl; 17 18 import com.google.gwt.user.client.rpc.SerializationException; 19 import com.google.gwt.user.client.rpc.SerializationStreamReader; 20 21 import java.util.ArrayList ; 22 23 28 public abstract class AbstractSerializationStreamReader extends 29 AbstractSerializationStream implements SerializationStreamReader { 30 31 private ArrayList seenArray = new ArrayList (); 32 33 public void prepareToRead(String encoded) throws SerializationException { 34 seenArray.clear(); 35 36 setVersion(readInt()); 39 40 setFlags(readInt()); 43 } 44 45 public final Object readObject() throws SerializationException { 46 int token = readInt(); 47 48 if (token < 0) { 49 return seenArray.get(-(token + 1)); 52 } 53 54 String typeSignature = getString(token); 56 if (typeSignature == null) { 57 return null; 59 } 60 61 return deserialize(typeSignature); 62 } 63 64 71 protected abstract Object deserialize(String typeSignature) 72 throws SerializationException; 73 74 80 protected abstract String getString(int index); 81 82 protected final void rememberDecodedObject(Object o) { 83 seenArray.add(o); 84 } 85 86 } 87 | Popular Tags |