/[classpath]/classpath/org/omg/CORBA/ValueBaseHelper.java
ViewVC logotype

Diff of /classpath/org/omg/CORBA/ValueBaseHelper.java

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

revision 1.2 by audriusa, Fri Jun 3 12:35:12 2005 UTC revision 1.3 by audriusa, Sat Jun 11 15:00:32 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package org.omg.CORBA;  package org.omg.CORBA;
40    
41  import gnu.CORBA.CDR.uncObjectInputStream;  import gnu.CORBA.CDR.Vio;
 import gnu.CORBA.CDR.uncObjectOutputStream;  
42  import gnu.CORBA.recordTypeCode;  import gnu.CORBA.recordTypeCode;
43    
44  import org.omg.CORBA.portable.InputStream;  import org.omg.CORBA.portable.InputStream;
45  import org.omg.CORBA.portable.OutputStream;  import org.omg.CORBA.portable.OutputStream;
46    
 import java.io.IOException;  
 import java.io.ObjectInputStream;  
 import java.io.ObjectOutputStream;  
47  import java.io.Serializable;  import java.io.Serializable;
48    
49  /**  /**
# Line 95  public abstract class ValueBaseHelper Line 91  public abstract class ValueBaseHelper
91    
92    /**    /**
93     * Read the value base from the given input stream.     * Read the value base from the given input stream.
    * This implementation initialises the {@link ObjectInputStream}  
    * and reads from it.  
94     *     *
95     * @param istream a stream to read from.     * @param input a stream to read from.
96     *     *
97     * @return the loaded value.     * @return the loaded value.
98     *     *
99     * @throws MARSHAL if the reading has failed due any reason.     * @throws MARSHAL if the reading has failed due any reason.
100     */     */
101    public static Serializable read(InputStream output)    public static Serializable read(InputStream input)
102    {    {
103      // Explicitly prevent the stream from closing as we may need      return Vio.read(input);
     // to read the subsequent bytes as well. Stream may be auto-closed  
     // in its finalizer.  
     try  
       {  
         ObjectInputStream oin = new uncObjectInputStream(output);  
         return (Serializable) oin.readObject();  
       }  
     catch (Exception ex)  
       {  
         throw new MARSHAL(ex + ":" + ex.getMessage());  
       }  
104    }    }
105    
106    /**    /**
# Line 131  public abstract class ValueBaseHelper Line 114  public abstract class ValueBaseHelper
114    }    }
115    
116    /**    /**
117     * Write the value base into the given stream. This implementation     * Write the value base into the given stream.
    * initialises the {@link ObjectOutputStream} and writes through it.  
118     *     *
119     * @param ostream a stream to write to.     * If the passed value implements the {@link CustomMarshal},
120       * the helper uses {@link CustomMarshal#marshal}
121       * to write the content in a user defined way. Otherwise,
122       * this implementation initialises the {@link ObjectOutputStream}
123       * and writes through it.
124       *
125       * @param output a stream to write to.
126     *     *
127     * @param value a value to write.     * @param value a value to write.
128     *     *
129     * @throws MARSHAL if the writing failed due any reason.     * @throws MARSHAL if the writing failed due any reason.
130     */     */
131    public static void write(OutputStream input, Serializable value)    public static void write(OutputStream output, Serializable value)
132    {    {
133      // Explicitly prevent the stream from closing as we may need      Vio.write(output, value);
     // to read the subsequent bytes as well. Stream may be auto-closed  
     // in its finalizer.  
     try  
       {  
         ObjectOutputStream oout = new uncObjectOutputStream(input);  
         oout.writeObject(value);  
         oout.flush();  
       }  
     catch (IOException ex)  
       {  
         throw new MARSHAL(ex + ":" + ex.getMessage());  
       }  
134    }    }
135  }  }

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

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