1 package com.quadcap.sql.io; 2 3 40 41 import java.io.EOFException ; 42 import java.io.Externalizable ; 43 import java.io.InputStream ; 44 import java.io.InvalidClassException ; 45 import java.io.IOException ; 46 import java.io.ObjectInput ; 47 48 import java.util.Vector ; 49 50 import com.quadcap.util.Debug; 51 52 57 public class ObjectInputStream extends DataInputStream implements ObjectInput { 58 public ObjectInputStream(InputStream is) { 59 super(is); 60 } 61 62 public Object readObject() throws IOException , ClassNotFoundException { 63 int code = read(); 64 if (code == 0) return null; 65 if (code == -1) { 66 throw new EOFException (); 67 } 68 Extern ext = null; 69 try { 70 ext = Extern.get(code); 71 } catch (Throwable e) { 72 ext = null; 73 } 74 if (ext == null) { 75 throw new IOException ("Corrupted stream: bad code: " + code); 76 } 77 Object ret = ext.readObject(this); 78 return ret; 79 } 80 } 81 | Popular Tags |