Rev | Line | |
---|
[44] | 1 | package omq.common.util.Serializers; |
---|
| 2 | |
---|
| 3 | import omq.common.message.Request; |
---|
| 4 | import omq.common.message.Response; |
---|
| 5 | import omq.exception.SerializerException; |
---|
| 6 | import omq.server.RemoteObject; |
---|
| 7 | |
---|
| 8 | /** |
---|
[83] | 9 | * An ISerializer object can serialize any kind of objects and deserialize |
---|
| 10 | * Requests and Responses. |
---|
[44] | 11 | * |
---|
| 12 | * @author Sergi Toda <sergi.toda@estudiants.urv.cat> |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | public interface ISerializer { |
---|
[83] | 16 | /** |
---|
| 17 | * Serialize |
---|
| 18 | * |
---|
| 19 | * @param obj |
---|
| 20 | * - object to serialize |
---|
| 21 | * @return objectSerialized |
---|
| 22 | * @throws SerializerException |
---|
| 23 | * - If the serialization failed |
---|
| 24 | */ |
---|
[44] | 25 | public byte[] serialize(Object obj) throws SerializerException; |
---|
| 26 | |
---|
[83] | 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 | */ |
---|
[44] | 38 | public Request deserializeRequest(byte[] bytes, RemoteObject obj) throws SerializerException; |
---|
| 39 | |
---|
[83] | 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 | */ |
---|
[44] | 51 | public Response deserializeResponse(byte[] bytes, Class<?> type) throws SerializerException; |
---|
| 52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.