/*      */ public void write_value(org.omg.CORBA.portable.OutputStream paramOutputStream)
       /*      */ {
   /*  594 */ if (isStreamed[realType().kind().value()] != 0) {
     /*  595 */ this.typeCode.copy(this.stream.dup(), paramOutputStream);
     /*      */ }
   /*      */ else
     /*  598 */ TCUtility.marshalIn(paramOutputStream, realType(), this.value, this.object);
   /*      */ }
Beispiel #2
0
 //
 // We could optimize this by noticing whether the target stream
 // has ever had anything marshaled on it that required an
 // alignment of greater than 4 (was write_double() ever called on it).
 // If not, then we can just do a byte array copy without having to
 // drive the remarshaling through typecode interpretation.
 //
 public void write_value(OutputStream out) {
   // debug.log ("write_value");
   if (AnyImpl.isStreamed[realType().kind().value()]) {
     typeCode.copy(stream.dup(), out);
   } else {
     // _REVISIT_ check isInitialized whether all we write is TypeCode!
     TCUtility.marshalIn(out, realType(), value, object);
   }
 }
 /*      */ public org.omg.CORBA.portable.InputStream create_input_stream() /*      */ {
   /*  522 */ if (isStreamed[realType().kind().value()] != 0) {
     /*  523 */ return this.stream.dup();
     /*      */ }
   /*  525 */ org.omg.CORBA.portable.OutputStream localOutputStream =
       this.orb.create_output_stream();
   /*  526 */ TCUtility.marshalIn(localOutputStream, realType(), this.value, this.object);
   /*      */
   /*  528 */ return localOutputStream.create_input_stream();
   /*      */ }
Beispiel #4
0
  /**
   * returns an input stream that an Any value can be marshaled out of.
   *
   * @result the InputStream to marshal value of Any out of.
   */
  public org.omg.CORBA.portable.InputStream create_input_stream() {
    //
    // We create a new InputStream so that multiple threads can call here
    // and read the streams in parallel without thread safety problems.
    //
    // debug.log ("create_input_stream");
    if (AnyImpl.isStreamed[realType().kind().value()]) {
      return stream.dup();
    } else {
      OutputStream os = (OutputStream) orb.create_output_stream();
      TCUtility.marshalIn(os, realType(), value, object);

      return os.create_input_stream();
    }
  }
Beispiel #5
0
  //
  // If the InputStream is a CDRInputStream then we can copy the bytes
  // since it is in our format and does not have alignment issues.
  //
  public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) {
    // debug.log ("read_value");
    //
    // Assume that someone isn't going to think they can keep reading
    // from this stream after calling us. That would be likely for
    // an IIOPInputStream but if it is an AnyInputStream then they
    // presumably obtained it via our create_output_stream() so they could
    // write the contents of an IDL data type to it and then call
    // create_input_stream() for us to read it. This is how Helper classes
    // typically implement the insert() method.
    // We should probably document this behavior in the 1.1 revision
    // task force.
    //

    typeCode = TypeCodeImpl.convertToNative(orb, tc);
    int kind = realType().kind().value();
    if (kind >= isStreamed.length) {
      throw wrapper.invalidIsstreamedTckind(CompletionStatus.COMPLETED_MAYBE, new Integer(kind));
    }

    if (AnyImpl.isStreamed[kind]) {
      if (in instanceof AnyInputStream) {
        // could only have been created here
        stream = (CDRInputStream) in;
      } else {
        org.omg.CORBA_2_3.portable.OutputStream out =
            (org.omg.CORBA_2_3.portable.OutputStream) orb.create_output_stream();
        typeCode.copy((org.omg.CORBA_2_3.portable.InputStream) in, out);
        stream = (CDRInputStream) out.create_input_stream();
      }
    } else {
      java.lang.Object[] objholder = new java.lang.Object[1];
      objholder[0] = object;
      long[] longholder = new long[1];
      TCUtility.unmarshalIn(in, realType(), longholder, objholder);
      value = longholder[0];
      object = objholder[0];
      stream = null;
    }
    isInitialized = true;
  }
 /*      */ public void read_value(
     org.omg.CORBA.portable.InputStream paramInputStream, TypeCode paramTypeCode)
       /*      */ {
   /*  554 */ this.typeCode = TypeCodeImpl.convertToNative(this.orb, paramTypeCode);
   /*  555 */ int i = realType().kind().value();
   /*  556 */ if (i >= isStreamed.length)
     /*  557 */ throw this.wrapper.invalidIsstreamedTckind(
         CompletionStatus.COMPLETED_MAYBE, new Integer(i));
   /*      */ java.lang.Object localObject;
   /*  561 */ if (isStreamed[i] != 0) {
     /*  562 */ if ((paramInputStream instanceof AnyInputStream))
     /*      */ {
       /*  564 */ this.stream = ((CDRInputStream) paramInputStream);
       /*      */ } else {
       /*  566 */ localObject =
           (org.omg.CORBA_2_3.portable.OutputStream) this.orb.create_output_stream();
       /*      */
       /*  568 */ this.typeCode.copy(
           (org.omg.CORBA_2_3.portable.InputStream) paramInputStream,
           (org.omg.CORBA.portable.OutputStream) localObject);
       /*  569 */ this.stream =
           ((CDRInputStream)
               ((org.omg.CORBA_2_3.portable.OutputStream) localObject).create_input_stream());
       /*      */ }
     /*      */ } else {
     /*  572 */ localObject = new java.lang.Object[1];
     /*  573 */ localObject[0] = this.object;
     /*  574 */ long[] arrayOfLong = new long[1];
     /*  575 */ TCUtility.unmarshalIn(
         paramInputStream, this.typeCode, arrayOfLong, (java.lang.Object[]) localObject);
     /*  576 */ this.value = arrayOfLong[0];
     /*  577 */ this.object = localObject[0];
     /*  578 */ this.stream = null;
     /*      */ }
   /*  580 */ this.isInitialized = true;
   /*      */ }