1 8 9 package mx4j.tools.remote.caucho.burlap; 10 11 import java.io.IOException ; 12 import java.io.InputStream ; 13 14 import com.caucho.burlap.io.BurlapInput; 15 import mx4j.tools.remote.caucho.CauchoInput; 16 import mx4j.tools.remote.caucho.serialization.JMXSerializerFactory; 17 18 21 class BurlapCauchoInput implements CauchoInput 22 { 23 private final BurlapInput input; 24 25 BurlapCauchoInput(InputStream stream) 26 { 27 this.input = new BurlapInput(); 28 input.setSerializerFactory(new JMXSerializerFactory()); 29 input.init(stream); 30 } 31 32 public void startCall() throws IOException 33 { 34 input.readCall(); 35 } 36 37 public void completeCall() throws IOException 38 { 39 input.completeCall(); 40 } 41 42 public void startReply() throws Exception 43 { 44 try 45 { 46 input.startReply(); 47 } catch (Throwable x) 48 { 49 if (x instanceof Exception ) throw (Exception ) x; 50 throw (Error ) x; 51 } 52 } 53 54 public void completeReply() throws IOException 55 { 56 input.completeReply(); 57 } 58 59 public String readHeader() throws IOException 60 { 61 return input.readHeader(); 62 } 63 64 public String readMethod() throws IOException 65 { 66 return input.readMethod(); 67 } 68 69 public Object readObject(Class cls) throws IOException 70 { 71 if (cls == null || cls == Object .class) return input.readObject(); 72 return input.readObject(cls); 73 } 74 } 75 | Popular Tags |