source: trunk/src/main/java/omq/common/util/Serializers/ISerializer.java @ 97

Last change on this file since 97 was 83, checked in by stoda, 11 years ago

J

File size: 1.3 KB
Line 
1package omq.common.util.Serializers;
2
3import omq.common.message.Request;
4import omq.common.message.Response;
5import omq.exception.SerializerException;
6import omq.server.RemoteObject;
7
8/**
9 * An ISerializer object can serialize any kind of objects and deserialize
10 * Requests and Responses.
11 *
12 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
13 *
14 */
15public interface ISerializer {
16        /**
17         * Serialize
18         *
19         * @param obj
20         *            - object to serialize
21         * @return objectSerialized
22         * @throws SerializerException
23         *             - If the serialization failed
24         */
25        public byte[] serialize(Object obj) throws SerializerException;
26
27        /**
28         * Deserialize a Request
29         *
30         * @param bytes
31         *            - serialized request
32         * @param obj
33         *            - remoteObject which is receiving requests
34         * @return request
35         * @throws SerializerException
36         *             - If the serialization failed
37         */
38        public Request deserializeRequest(byte[] bytes, RemoteObject obj) throws SerializerException;
39
40        /**
41         * Deserialize a Response
42         *
43         * @param bytes
44         *            serialized response
45         * @param type
46         *            - return type expected
47         * @return response
48         * @throws SerializerException
49         *             - If the serialization failed
50         */
51        public Response deserializeResponse(byte[] bytes, Class<?> type) throws SerializerException;
52}
Note: See TracBrowser for help on using the repository browser.