KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > user > client > rpc > impl > Serializer


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

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 import com.google.gwt.user.client.rpc.SerializationStreamWriter;
21
22 /**
23  * Contract for any class that can serialize and restore class into a
24  * serialization stream.
25  */

26 public interface Serializer {
27
28   /**
29    * Restore an instantiated object from the serialized stream.
30    */

31   void deserialize(SerializationStreamReader stream, Object JavaDoc instance,
32       String JavaDoc typeSignature) throws SerializationException;
33
34   /**
35    * Return the serialization signature for the given type name.
36    */

37   String JavaDoc getSerializationSignature(String JavaDoc typeName);
38
39   /**
40    * Instantiate an object of the given typeName from the serialized stream.
41    */

42   Object JavaDoc instantiate(SerializationStreamReader stream, String JavaDoc typeSignature)
43       throws SerializationException;
44
45   /**
46    * Save an instance into the serialization stream.
47    */

48   void serialize(SerializationStreamWriter stream, Object JavaDoc instance,
49       String JavaDoc typeSignature) throws SerializationException;
50 }
51
Popular Tags