52 |
import org.omg.CORBA.IntHolder; |
import org.omg.CORBA.IntHolder; |
53 |
import org.omg.CORBA.LongHolder; |
import org.omg.CORBA.LongHolder; |
54 |
import org.omg.CORBA.MARSHAL; |
import org.omg.CORBA.MARSHAL; |
|
import org.omg.CORBA.NO_IMPLEMENT; |
|
55 |
import org.omg.CORBA.ORB; |
import org.omg.CORBA.ORB; |
56 |
import org.omg.CORBA.ObjectHolder; |
import org.omg.CORBA.ObjectHolder; |
57 |
import org.omg.CORBA.Principal; |
import org.omg.CORBA.Principal; |
62 |
import org.omg.CORBA.TypeCode; |
import org.omg.CORBA.TypeCode; |
63 |
import org.omg.CORBA.TypeCodeHolder; |
import org.omg.CORBA.TypeCodeHolder; |
64 |
import org.omg.CORBA.TypeCodePackage.BadKind; |
import org.omg.CORBA.TypeCodePackage.BadKind; |
65 |
|
import org.omg.CORBA.ValueBaseHolder; |
66 |
import org.omg.CORBA.portable.Streamable; |
import org.omg.CORBA.portable.Streamable; |
67 |
|
|
68 |
import java.io.IOException; |
import java.io.IOException; |
148 |
*/ |
*/ |
149 |
public org.omg.CORBA.portable.InputStream create_input_stream() |
public org.omg.CORBA.portable.InputStream create_input_stream() |
150 |
{ |
{ |
151 |
cdrBufOutput out = new cdrBufOutput(); |
if (has instanceof universalHolder) |
152 |
out.setOrb(orb); |
{ |
153 |
write_value(out); |
universalHolder u = (universalHolder) has; |
154 |
cdrBufInput in = new cdrBufInput(out.buffer.toByteArray()); |
return u.getInputStream(); |
155 |
in.setOrb(orb); |
} |
156 |
return in; |
else |
157 |
|
{ |
158 |
|
cdrBufOutput out = new cdrBufOutput(); |
159 |
|
out.setOrb(orb); |
160 |
|
write_value(out); |
161 |
|
|
162 |
|
cdrBufInput in = new cdrBufInput(out.buffer.toByteArray()); |
163 |
|
in.setOrb(orb); |
164 |
|
return in; |
165 |
|
} |
166 |
} |
} |
167 |
|
|
168 |
/** |
/** |
265 |
return ((TypeCodeHolder) has).value; |
return ((TypeCodeHolder) has).value; |
266 |
} |
} |
267 |
|
|
268 |
|
/** |
269 |
|
* Extract the stored value type. |
270 |
|
* |
271 |
|
* @return the previously stored value type. |
272 |
|
* |
273 |
|
* @throws BAD_OPERATION if the Any contains something different. |
274 |
|
* |
275 |
|
* @see org.omg.CORBA.portable.ValueBase |
276 |
|
*/ |
277 |
public Serializable extract_Value() |
public Serializable extract_Value() |
278 |
throws BAD_OPERATION |
throws BAD_OPERATION |
279 |
{ |
{ |
280 |
/**@todo Implement this org.omg.CORBA.Any abstract method*/ |
try |
281 |
throw new java.lang.UnsupportedOperationException("Method extract_Value() not yet implemented."); |
{ |
282 |
|
return ((ValueBaseHolder) has).value; |
283 |
|
} |
284 |
|
catch (ClassCastException ex) |
285 |
|
{ |
286 |
|
return new BAD_OPERATION("Value type expected"); |
287 |
|
} |
288 |
} |
} |
289 |
|
|
290 |
/** {@inheritDoc} */ |
/** {@inheritDoc} */ |
489 |
/** {@inheritDoc} */ |
/** {@inheritDoc} */ |
490 |
public void insert_Value(Serializable x, TypeCode typecode) |
public void insert_Value(Serializable x, TypeCode typecode) |
491 |
{ |
{ |
492 |
resetTypes(); |
type(typecode); |
493 |
|
insert_Value(x); |
|
/**@todo Implement this org.omg.CORBA.Any abstract method*/ |
|
494 |
} |
} |
495 |
|
|
496 |
/** {@inheritDoc} */ |
/** {@inheritDoc} */ |
497 |
public void insert_Value(Serializable x) |
public void insert_Value(Serializable x) |
498 |
{ |
{ |
499 |
resetTypes(); |
resetTypes(); |
500 |
|
if (has instanceof ValueBaseHolder) |
501 |
/**@todo Implement this org.omg.CORBA.Any abstract method*/ |
((ValueBaseHolder) has).value = x; |
502 |
|
else |
503 |
|
has = new ValueBaseHolder(x); |
504 |
} |
} |
505 |
|
|
506 |
/** |
/** |
726 |
{ |
{ |
727 |
has = holderFactory.createHolder(a_type); |
has = holderFactory.createHolder(a_type); |
728 |
if (has == null) |
if (has == null) |
729 |
throw new NO_IMPLEMENT("Not implemented for " + |
{ |
730 |
typeNamer.nameIt(a_type) |
// Use the Universal Holder that reads till the end of stream. |
731 |
); |
// This works with the extract/insert pair of the typical |
732 |
|
// Helper. |
733 |
|
cdrBufOutput buffer = new cdrBufOutput(); |
734 |
|
buffer.setOrb(orb); |
735 |
|
has = new universalHolder(buffer); |
736 |
|
} |
737 |
} |
} |
738 |
type(a_type); |
type(a_type); |
739 |
has._read(input); |
has._read(input); |
815 |
typecode = null; |
typecode = null; |
816 |
xKind = -1; |
xKind = -1; |
817 |
} |
} |
818 |
} |
} |