/[classpath]/classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
ViewVC logotype

Diff of /classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cbj, Thu Mar 21 05:40:11 2002 UTC revision 1.2 by mark, Thu Oct 31 18:35:21 2002 UTC
# Line 61  public class RMIMarshalledObjectOutputSt Line 61  public class RMIMarshalledObjectOutputSt
61    public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException    public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException
62    {    {
63      super(objStream);      super(objStream);
64        locBytesStream = new ByteArrayOutputStream(256);
65        locStream = new ObjectOutputStream(locBytesStream);
66    }    }
67        
68    //This method overrides RMIObjectOutputStream's.    //This method overrides RMIObjectOutputStream's.
69    protected void setAnnotation(String annotation) throws IOException{    protected void setAnnotation(String annotation) throws IOException{
     synchronized(this){  
       if(locStream == null){  
         locBytesStream = new ByteArrayOutputStream();  
         locStream = new ObjectOutputStream(locBytesStream);  
       }  
     }  
70      locStream.writeObject(annotation);      locStream.writeObject(annotation);
71    }    }
72        
   //This method overrides ObjectOutputStream's to replace Remote to RemoteStub  
   protected Object replaceObject(Object obj) throws IOException  
   {  
     if((obj instanceof Remote) && !(obj instanceof RemoteStub))  
       {  
         UnicastServerRef ref = new UnicastServerRef(new ObjID(), 0, null);  
         try{  
           return ref.exportObject((Remote)obj);  
         }catch(Exception e){}  
       }  
     return obj;  
   }  
     
73    public void flush() throws IOException {    public void flush() throws IOException {
74      super.flush();      super.flush();
75      if(locStream != null)      locStream.flush();
       locStream.flush();  
76    }    }
77        
78    public byte[] getLocBytes(){    public byte[] getLocBytes(){
79      if(locStream != null)      return locBytesStream.toByteArray();
       return locBytesStream.toByteArray();  
     return null;  
80    }    }
81        
82  } // End of RMIMarshalledObjectOutputStream  } // End of RMIMarshalledObjectOutputStream

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26