KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Byte
14  */

15 public final class ByteSerializer implements Serializer {
16   
17   public void serializeTo(Object JavaDoc o, ObjectOutput JavaDoc out) throws IOException JavaDoc {
18     out.writeByte(((Byte JavaDoc)o).byteValue());
19   }
20   
21   public Object JavaDoc deserializeFrom(ObjectInput JavaDoc in) throws IOException JavaDoc {
22     return new Byte JavaDoc(in.readByte());
23   }
24
25   public byte getSerializerID() {
26     return BYTE;
27   }
28   
29 }
Popular Tags