diff options
Diffstat (limited to 'org/omg/CORBA_2_3/portable/OutputStream.java')
-rw-r--r-- | org/omg/CORBA_2_3/portable/OutputStream.java | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/org/omg/CORBA_2_3/portable/OutputStream.java b/org/omg/CORBA_2_3/portable/OutputStream.java index bc317a662..2f83a939f 100644 --- a/org/omg/CORBA_2_3/portable/OutputStream.java +++ b/org/omg/CORBA_2_3/portable/OutputStream.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -38,8 +38,8 @@ exception statement from your version. */ package org.omg.CORBA_2_3.portable; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.ValueBaseHelper; +import gnu.CORBA.CDR.Vio; + import org.omg.CORBA.portable.BoxedValueHelper; import org.omg.CORBA.portable.ValueBase; @@ -58,10 +58,6 @@ import java.io.Serializable; * derived class and the new methods are accessible after the casting * operation. * - * OMG specification states the writing format of the value types - * is outside the scope of GIOP definition. This implementation uses - * java serialization mechanism, calling {@link ObjectInputStream#readObject}. - * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ public abstract class OutputStream @@ -73,37 +69,49 @@ public abstract class OutputStream * the boolean discriminator (false for objects, true for value types). * * The object from value is separated by fact that all values implement - * the {@link ValueBase} interface. + * the {@link ValueBase} interface. Also, the passed parameter is treated + * as value it it does not implement CORBA Object. * * @param an_interface an abstract interface to write. */ - public void write_abstract_interface(org.omg.CORBA.Object an_interface) + public void write_abstract_interface(java.lang.Object an_interface) { - boolean isValue = an_interface instanceof ValueBase; + boolean isValue = + an_interface instanceof ValueBase || + (!(an_interface instanceof org.omg.CORBA.Object)); write_boolean(isValue); if (isValue) write_value((ValueBase) an_interface); else - write_Object(an_interface); + write_Object((org.omg.CORBA.Object) an_interface); } /** - * Writes a value type into the output stream as java Serializable. + * Writes a value type into the output stream. * - * The functionality is delegated to the {@link ValueBaseHelper}. + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StramableValue} + * (for standard writing using code, generated by IDL compiler). + * + * The written record will have a repository id, matching the + * class of the passed object. The codebase will not be written. * * @param value a value type object to write. */ public void write_value(Serializable value) { - ValueBaseHelper.write(this, value); + Vio.write(this, value); } /** * Write value to the stream using the boxed value helper. * + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StramableValue} + * (for standard writing using code, generated by IDL compiler). + * * @param value a value to write. * @param helper a helper, responsible for the writing operation. */ @@ -113,26 +121,29 @@ public abstract class OutputStream } /** - * Writes a value type into the output stream as java Serializable, - * stating it is an instance of the given class. + * Writes a value type into the output stream, stating it is an + * instance of the given class. The written record + * will have a repository id, matching the passed class. + * The codebase will not be written. * - * The functionality is delegated to the {@link ValueBaseHelper}. - * The passed class is used for the check only. + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StramableValue} + * (for standard writing using code, generated by IDL compiler). * * @param value a value type object to write. */ public void write_value(Serializable value, Class clz) { - if (!clz.isAssignableFrom(value.getClass())) - throw new MARSHAL("The class is not the same"); - ValueBaseHelper.write(this, value); + Vio.write(this, value, clz); } /** - * Writes a value type into the output stream as java Serializable, + * Writes a value type into the output stream, * stating it has the given repository id. * - * The functionality is delegated to the {@link ValueBaseHelper}. + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StramableValue} + * (for standard writing using code, generated by IDL compiler). * * @param repository_id a repository id of the value type. * @@ -140,6 +151,6 @@ public abstract class OutputStream */ public void write_value(Serializable value, String repository_id) { - ValueBaseHelper.write(this, value); + Vio.write(this, value, repository_id); } }
\ No newline at end of file |