1 18 package org.apache.geronimo.interop.rmi.iiop; 19 20 import java.io.IOException ; 21 22 import org.apache.geronimo.interop.util.JavaObject; 23 24 public class SimpleObjectInputStream extends ObjectInputStream 25 { 26 public static ObjectInputStream getInstance() 27 { 28 ObjectInputStream ois = null; 29 try { 30 ois = new SimpleObjectInputStream(); 31 } catch (IOException e) { 32 e.printStackTrace(); } 34 return ois; 35 } 36 37 public static ObjectInputStream getInstance(byte[] bytes) 38 { 39 return getInstance(CdrInputStream.getInstance(bytes)); 40 } 41 42 public static ObjectInputStream getInstance(org.apache.geronimo.interop.rmi.iiop.CdrInputStream cdrInput) 43 { 44 ObjectInputStream input = getInstance(); 45 input.init(cdrInput); 46 return input; 47 } 48 49 public static ObjectInputStream getPooledInstance() 50 { 51 ObjectInputStream input = null; 52 if (input == null) 53 { 54 input = getInstance(); 55 } 56 return input; 57 } 58 59 63 67 public SimpleObjectInputStream() throws IOException 68 { 69 super(); 70 } 71 72 public void $reset() 73 { 74 _cdrInput.reset(); 75 } 76 77 public void recycle() 78 { 79 $reset(); 80 } 81 82 public Exception readException(ValueType type) 83 { 84 return (Exception )readObject(type); 85 } 86 87 public Object readObject(ValueType type) 88 { 89 ObjectHelper h = type.helper; 90 if (h != null) 91 { 92 return h.read(this); 93 } 94 byte[] bytes = _cdrInput.read_octet_sequence(); 95 Object value = bytes.length == 0 ? null : JavaObject.fromByteArray(bytes); 96 return value; 97 } 98 99 103 protected void init(org.apache.geronimo.interop.rmi.iiop.CdrInputStream cdrInput) 104 { 105 super.init(cdrInput); 106 } 107 } 108 | Popular Tags |