KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > io > serializer > impl > ShortSerializer


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.io.serializer.impl;
5
6 import com.tc.io.serializer.api.Serializer;
7
8 import java.io.IOException JavaDoc;
9 import java.io.ObjectInput JavaDoc;
10 import java.io.ObjectOutput JavaDoc;
11
12 /**
13  * Short
14  */

15 public final class ShortSerializer implements Serializer {
16
17   public void serializeTo(Object JavaDoc o, ObjectOutput JavaDoc out) throws IOException JavaDoc {
18     out.writeShort(((Short JavaDoc)o).shortValue());
19   }
20
21   public Object JavaDoc deserializeFrom(ObjectInput JavaDoc in) throws IOException JavaDoc {
22     return new Short JavaDoc(in.readShort());
23   }
24
25   public byte getSerializerID() {
26     return SHORT;
27   }
28   
29 }
Popular Tags