01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.io.serializer.api;
05:
06: import java.io.IOException;
07: import java.io.ObjectInput;
08: import java.io.ObjectOutput;
09:
10: public class BasicSerializer implements Serializer {
11:
12: private final SerializerPolicy serializers;
13:
14: public BasicSerializer(SerializerPolicy serializers) {
15: this .serializers = serializers;
16: }
17:
18: public void serializeTo(Object o, ObjectOutput out)
19: throws IOException {
20: serializers.getSerializerFor(o, out).serializeTo(o, out);
21: }
22:
23: public Object deserializeFrom(ObjectInput in) throws IOException,
24: ClassNotFoundException {
25: return serializers.getSerializerFor(in).deserializeFrom(in);
26: }
27:
28: public byte getSerializerID() {
29: return UNKNOWN;
30: }
31:
32: }
|