KickJava   Java API By Example, From Geeks To Geeks.

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


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

15 public final class BooleanSerializer implements Serializer {
16
17   public void serializeTo(Object JavaDoc o, ObjectOutput JavaDoc out) throws IOException JavaDoc {
18     boolean b = ((Boolean JavaDoc)o).booleanValue();
19     out.writeBoolean(b);
20   }
21
22   public Object JavaDoc deserializeFrom(ObjectInput JavaDoc in) throws IOException JavaDoc {
23     return new Boolean JavaDoc(in.readBoolean());
24   }
25
26   public byte getSerializerID() {
27     return BOOLEAN;
28   }
29   
30 }
Popular Tags