38 |
|
|
39 |
package org.omg.CORBA_2_3.portable; |
package org.omg.CORBA_2_3.portable; |
40 |
|
|
41 |
import org.omg.CORBA.MARSHAL; |
import gnu.CORBA.CDR.Vio; |
42 |
import org.omg.CORBA.ValueBaseHelper; |
|
43 |
import org.omg.CORBA.portable.BoxedValueHelper; |
import org.omg.CORBA.portable.BoxedValueHelper; |
44 |
import org.omg.CORBA.portable.ValueBase; |
import org.omg.CORBA.portable.ValueBase; |
45 |
|
|
58 |
* derived class and the new methods are accessible after the casting |
* derived class and the new methods are accessible after the casting |
59 |
* operation. |
* operation. |
60 |
* |
* |
|
* 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}. |
|
|
* |
|
61 |
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org) |
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org) |
62 |
*/ |
*/ |
63 |
public abstract class OutputStream |
public abstract class OutputStream |
89 |
} |
} |
90 |
|
|
91 |
/** |
/** |
92 |
* Writes a value type into the output stream as java Serializable. |
* Writes a value type into the output stream. |
93 |
|
* |
94 |
|
* The value type must implement either {@link CustomValue} |
95 |
|
* (for user-defined writing method) or {@link StramableValue} |
96 |
|
* (for standard writing using code, generated by IDL compiler). |
97 |
* |
* |
98 |
* The functionality is delegated to the {@link ValueBaseHelper}. |
* The written record will have a repository id, matching the |
99 |
|
* class of the passed object. The codebase will not be written. |
100 |
* |
* |
101 |
* @param value a value type object to write. |
* @param value a value type object to write. |
102 |
*/ |
*/ |
103 |
public void write_value(Serializable value) |
public void write_value(Serializable value) |
104 |
{ |
{ |
105 |
ValueBaseHelper.write(this, value); |
Vio.write(this, value); |
106 |
} |
} |
107 |
|
|
108 |
/** |
/** |
109 |
* Write value to the stream using the boxed value helper. |
* Write value to the stream using the boxed value helper. |
110 |
* |
* |
111 |
|
* The value type must implement either {@link CustomValue} |
112 |
|
* (for user-defined writing method) or {@link StramableValue} |
113 |
|
* (for standard writing using code, generated by IDL compiler). |
114 |
|
* |
115 |
* @param value a value to write. |
* @param value a value to write. |
116 |
* @param helper a helper, responsible for the writing operation. |
* @param helper a helper, responsible for the writing operation. |
117 |
*/ |
*/ |
121 |
} |
} |
122 |
|
|
123 |
/** |
/** |
124 |
* Writes a value type into the output stream as java Serializable, |
* Writes a value type into the output stream, stating it is an |
125 |
* stating it is an instance of the given class. |
* instance of the given class. The written record |
126 |
* |
* will have a repository id, matching the passed class. |
127 |
* The functionality is delegated to the {@link ValueBaseHelper}. |
* The codebase will not be written. |
128 |
* The passed class is used for the check only. |
* |
129 |
|
* The value type must implement either {@link CustomValue} |
130 |
|
* (for user-defined writing method) or {@link StramableValue} |
131 |
|
* (for standard writing using code, generated by IDL compiler). |
132 |
* |
* |
133 |
* @param value a value type object to write. |
* @param value a value type object to write. |
134 |
*/ |
*/ |
135 |
public void write_value(Serializable value, Class clz) |
public void write_value(Serializable value, Class clz) |
136 |
{ |
{ |
137 |
if (!clz.isAssignableFrom(value.getClass())) |
Vio.write(this, value, clz); |
|
throw new MARSHAL("The class is not the same"); |
|
|
ValueBaseHelper.write(this, value); |
|
138 |
} |
} |
139 |
|
|
140 |
/** |
/** |
141 |
* Writes a value type into the output stream as java Serializable, |
* Writes a value type into the output stream, |
142 |
* stating it has the given repository id. |
* stating it has the given repository id. |
143 |
* |
* |
144 |
* The functionality is delegated to the {@link ValueBaseHelper}. |
* The value type must implement either {@link CustomValue} |
145 |
|
* (for user-defined writing method) or {@link StramableValue} |
146 |
|
* (for standard writing using code, generated by IDL compiler). |
147 |
* |
* |
148 |
* @param repository_id a repository id of the value type. |
* @param repository_id a repository id of the value type. |
149 |
* |
* |
151 |
*/ |
*/ |
152 |
public void write_value(Serializable value, String repository_id) |
public void write_value(Serializable value, String repository_id) |
153 |
{ |
{ |
154 |
ValueBaseHelper.write(this, value); |
Vio.write(this, value, repository_id); |
155 |
} |
} |
156 |
} |
} |