38 |
|
|
39 |
package gnu.CORBA; |
package gnu.CORBA; |
40 |
|
|
41 |
import gnu.CORBA.CDR.cdrBufInput; |
import gnu.CORBA.CDR.BufferredCdrInput; |
42 |
import gnu.CORBA.CDR.cdrBufOutput; |
import gnu.CORBA.CDR.BufferedCdrOutput; |
43 |
import gnu.CORBA.CDR.cdrInput; |
import gnu.CORBA.CDR.AbstractCdrInput; |
44 |
import gnu.CORBA.CDR.cdrOutput; |
import gnu.CORBA.CDR.AbstractCdrOutput; |
45 |
import gnu.CORBA.GIOP.CharSets_OSF; |
import gnu.CORBA.GIOP.CharSets_OSF; |
46 |
import gnu.CORBA.GIOP.cxCodeSet; |
import gnu.CORBA.GIOP.CodeSetServiceContext; |
47 |
|
|
48 |
import org.omg.CORBA.BAD_PARAM; |
import org.omg.CORBA.BAD_PARAM; |
49 |
import org.omg.CORBA.CompletionStatus; |
import org.omg.CORBA.CompletionStatus; |
174 |
* The negotiated coding result for this IOR. Saves time, requred for |
* The negotiated coding result for this IOR. Saves time, requred for |
175 |
* negotiation computations. |
* negotiation computations. |
176 |
*/ |
*/ |
177 |
public cxCodeSet negotiated; |
public CodeSetServiceContext negotiated; |
178 |
|
|
179 |
/** |
/** |
180 |
* Read the code set profile information from the given input stream. |
* Read the code set profile information from the given input stream. |
181 |
* |
* |
182 |
* @param profile a stream to read from. |
* @param profile a stream to read from. |
183 |
*/ |
*/ |
184 |
public void read(cdrInput profile) |
public void read(AbstractCdrInput profile) |
185 |
{ |
{ |
186 |
cdrBufInput encapsulation = profile.read_encapsulation(); |
BufferredCdrInput encapsulation = profile.read_encapsulation(); |
187 |
narrow.read(encapsulation); |
narrow.read(encapsulation); |
188 |
wide.read(encapsulation); |
wide.read(encapsulation); |
189 |
} |
} |
201 |
* |
* |
202 |
* @param profile a stream to write into. |
* @param profile a stream to write into. |
203 |
*/ |
*/ |
204 |
public void write(cdrOutput profile) |
public void write(AbstractCdrOutput profile) |
205 |
{ |
{ |
206 |
cdrOutput encapsulation = profile.createEncapsulation(); |
AbstractCdrOutput encapsulation = profile.createEncapsulation(); |
207 |
narrow.write(encapsulation); |
narrow.write(encapsulation); |
208 |
wide.write(encapsulation); |
wide.write(encapsulation); |
209 |
try |
try |
274 |
/** |
/** |
275 |
* Write the internet profile (except the heading tag. |
* Write the internet profile (except the heading tag. |
276 |
*/ |
*/ |
277 |
public void write(cdrOutput out) |
public void write(AbstractCdrOutput out) |
278 |
{ |
{ |
279 |
try |
try |
280 |
{ |
{ |
281 |
// Need to write the Internet profile into the separate |
// Need to write the Internet profile into the separate |
282 |
// stream as we must know the size in advance. |
// stream as we must know the size in advance. |
283 |
cdrOutput b = out.createEncapsulation(); |
AbstractCdrOutput b = out.createEncapsulation(); |
284 |
|
|
285 |
version.write(b); |
version.write(b); |
286 |
b.write_string(host); |
b.write_string(host); |
310 |
catch (Exception e) |
catch (Exception e) |
311 |
{ |
{ |
312 |
MARSHAL m = new MARSHAL("Unable to write Internet profile."); |
MARSHAL m = new MARSHAL("Unable to write Internet profile."); |
313 |
|
m.minor = Minor.IOR; |
314 |
m.initCause(e); |
m.initCause(e); |
315 |
throw m; |
throw m; |
316 |
} |
} |
393 |
buf.write(cx); |
buf.write(cx); |
394 |
} |
} |
395 |
|
|
396 |
cdrBufInput cdr = new cdrBufInput(buf.toByteArray()); |
BufferredCdrInput cdr = new BufferredCdrInput(buf.toByteArray()); |
397 |
|
|
398 |
r._read(cdr); |
r._read(cdr); |
399 |
return r; |
return r; |
412 |
* @param c a stream to read from. |
* @param c a stream to read from. |
413 |
* @throws IOException if the stream throws it. |
* @throws IOException if the stream throws it. |
414 |
*/ |
*/ |
415 |
public void _read(cdrInput c) |
public void _read(AbstractCdrInput c) |
416 |
throws IOException, BAD_PARAM |
throws IOException, BAD_PARAM |
417 |
{ |
{ |
418 |
int endian; |
int endian; |
434 |
* If the stream contains a null value, the Id and Internet fields become |
* If the stream contains a null value, the Id and Internet fields become |
435 |
* equal to null. Otherwise Id contains some string (possibly empty). |
* equal to null. Otherwise Id contains some string (possibly empty). |
436 |
* |
* |
437 |
* Id is checked for null in cdrInput that then returns null instead of |
* Id is checked for null in AbstractCdrInput that then returns null instead of |
438 |
* object. |
* object. |
439 |
* |
* |
440 |
* @param c a stream to read from. |
* @param c a stream to read from. |
441 |
* @throws IOException if the stream throws it. |
* @throws IOException if the stream throws it. |
442 |
*/ |
*/ |
443 |
public void _read_no_endian(cdrInput c) |
public void _read_no_endian(AbstractCdrInput c) |
444 |
throws IOException, BAD_PARAM |
throws IOException, BAD_PARAM |
445 |
{ |
{ |
446 |
Id = c.read_string(); |
Id = c.read_string(); |
457 |
for (int i = 0; i < n_profiles; i++) |
for (int i = 0; i < n_profiles; i++) |
458 |
{ |
{ |
459 |
int tag = c.read_long(); |
int tag = c.read_long(); |
460 |
cdrBufInput profile = c.read_encapsulation(); |
BufferredCdrInput profile = c.read_encapsulation(); |
461 |
|
|
462 |
if (tag == Internet_profile.TAG_INTERNET_IOP) |
if (tag == Internet_profile.TAG_INTERNET_IOP) |
463 |
{ |
{ |
516 |
* Write this IOR record to the provided CDR stream. This procedure writes the |
* Write this IOR record to the provided CDR stream. This procedure writes the |
517 |
* zero (Big Endian) marker first. |
* zero (Big Endian) marker first. |
518 |
*/ |
*/ |
519 |
public void _write(cdrOutput out) |
public void _write(AbstractCdrOutput out) |
520 |
{ |
{ |
521 |
// Always use Big Endian. |
// Always use Big Endian. |
522 |
out.write(0); |
out.write(0); |
529 |
* The null value is written as defined in OMG specification (zero length |
* The null value is written as defined in OMG specification (zero length |
530 |
* string, followed by an empty set of profiles). |
* string, followed by an empty set of profiles). |
531 |
*/ |
*/ |
532 |
public static void write_null(cdrOutput out) |
public static void write_null(AbstractCdrOutput out) |
533 |
{ |
{ |
534 |
// Empty Id string. |
// Empty Id string. |
535 |
out.write_string(""); |
out.write_string(""); |
542 |
* Write this IOR record to the provided CDR stream. The procedure writed data |
* Write this IOR record to the provided CDR stream. The procedure writed data |
543 |
* in Big Endian, but does NOT add any endian marker to the beginning. |
* in Big Endian, but does NOT add any endian marker to the beginning. |
544 |
*/ |
*/ |
545 |
public void _write_no_endian(cdrOutput out) |
public void _write_no_endian(AbstractCdrOutput out) |
546 |
{ |
{ |
547 |
// Write repository id. |
// Write repository id. |
548 |
out.write_string(Id); |
out.write_string(Id); |
596 |
*/ |
*/ |
597 |
public String toStringifiedReference() |
public String toStringifiedReference() |
598 |
{ |
{ |
599 |
cdrBufOutput out = new cdrBufOutput(); |
BufferedCdrOutput out = new BufferedCdrOutput(); |
600 |
|
|
601 |
_write(out); |
_write(out); |
602 |
|
|
676 |
TaggedComponent[] present; |
TaggedComponent[] present; |
677 |
if (profile.profile_data.length > 0) |
if (profile.profile_data.length > 0) |
678 |
{ |
{ |
679 |
cdrBufInput in = new cdrBufInput(profile.profile_data); |
BufferredCdrInput in = new BufferredCdrInput(profile.profile_data); |
680 |
|
|
681 |
present = new TaggedComponent[in.read_long()]; |
present = new TaggedComponent[in.read_long()]; |
682 |
|
|
688 |
else |
else |
689 |
present = new TaggedComponent[0]; |
present = new TaggedComponent[0]; |
690 |
|
|
691 |
cdrBufOutput out = new cdrBufOutput(profile.profile_data.length |
BufferedCdrOutput out = new BufferedCdrOutput(profile.profile_data.length |
692 |
+ component.component_data.length |
+ component.component_data.length |
693 |
+ 8); |
+ 8); |
694 |
|
|