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.impl;
05:
06: import com.tc.io.serializer.api.Serializer;
07: import com.tc.object.ObjectID;
08:
09: import java.io.IOException;
10: import java.io.ObjectInput;
11: import java.io.ObjectOutput;
12:
13: /**
14: * ObjectIDs
15: */
16: public final class ObjectIDSerializer implements Serializer {
17:
18: public void serializeTo(Object o, ObjectOutput out)
19: throws IOException {
20: out.writeLong(((ObjectID) o).toLong());
21: }
22:
23: public Object deserializeFrom(ObjectInput in) throws IOException {
24: return new ObjectID(in.readLong());
25: }
26:
27: public byte getSerializerID() {
28: return OBJECT_ID;
29: }
30: }
|