KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > rmi > readers > CharacterReader


1 package com.daffodilwoods.rmi.readers;
2
3 import java.io.ObjectInput JavaDoc;
4 import java.io.IOException JavaDoc;
5
6 public class CharacterReader implements _ObjectReader {
7   public static _ObjectReader objectReader = new CharacterReader();
8   private CharacterReader() {
9   }
10   public Object JavaDoc read(ObjectInput JavaDoc in) throws IOException JavaDoc,ClassNotFoundException JavaDoc {
11     boolean collatorPresent = in.readBoolean();
12     int str_length = (int) in.readShort();
13     byte[] str_bytes = new byte[str_length];
14     in.read(str_bytes);
15     return new String JavaDoc(str_bytes, collatorPresent ? "UTF16" : "ISO-8859-1");
16   }
17
18 }
19
Popular Tags