Example #1
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);
   }
 }
Example #2
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();
    }
  }