1 22 package org.jboss.util.stream; 23 24 import java.io.IOException ; 25 import java.io.ObjectOutputStream ; 26 import java.io.OutputStream ; 27 import java.rmi.Remote ; 28 import java.rmi.server.RemoteObject ; 29 import java.rmi.server.RemoteStub ; 30 31 40 public class MarshalledValueOutputStream 41 extends ObjectOutputStream 42 { 43 48 public MarshalledValueOutputStream(OutputStream os) throws IOException 49 { 50 super(os); 51 enableReplaceObject(true); 52 } 53 54 57 protected void annotateClass(Class cl) throws IOException 58 { 59 super.annotateClass(cl); 60 } 61 62 65 protected void annotateProxyClass(Class cl) throws IOException 66 { 67 super.annotateProxyClass(cl); 68 } 69 70 73 protected Object replaceObject(Object obj) throws IOException 74 { 75 if( (obj instanceof Remote ) && !(obj instanceof RemoteStub ) ) 76 { 77 Remote remote = (Remote ) obj; 78 try 79 { 80 obj = RemoteObject.toStub(remote); 81 } 82 catch(IOException ignore) 83 { 84 } 86 } 87 return obj; 88 } 89 } 90 | Popular Tags |