1 19 package gcc.rmi.iiop; 20 21 import gcc.*; 22 import gcc.util.*; 23 import java.io.*; 24 25 public class SimpleObjectInputStream extends ObjectInputStream 26 { 27 public static ObjectInputStream getInstance() 28 { 29 return getInstance(CdrInputStream.getInstance()); 30 } 31 32 public static ObjectInputStream getInstance(byte[] bytes) 33 { 34 return getInstance(CdrInputStream.getInstance(bytes)); 35 } 36 37 public static ObjectInputStream getInstance(gcc.rmi.iiop.CdrInputStream cdrInput) 38 { 39 ObjectInputStream input = null; 40 try 41 { 42 input = new SimpleObjectInputStream(); 43 } 44 catch( Exception ex ) 45 { 46 throw new SystemException(ex); 47 } 48 49 input.init(cdrInput); 50 return input; 51 } 52 53 57 61 public SimpleObjectInputStream() throws IOException 62 { 63 super(); 64 } 65 66 public void $reset() 67 { 68 _cdrInput.reset(); 69 } 70 71 public void recycle() 72 { 73 $reset(); 74 } 75 76 public Object readObject(ValueType type) 77 { 78 ObjectHelper h = type.helper; 79 if (h != null) 80 { 81 return h.read(this); 82 } 83 byte[] bytes = _cdrInput.read_octet_sequence(); 84 Object value = bytes.length == 0 ? null : JavaObject.fromByteArray(bytes); 85 return value; 86 } 87 88 92 protected void init(gcc.rmi.iiop.CdrInputStream cdrInput) 93 { 94 super.init(cdrInput); 95 } 96 } 97 | Popular Tags |