类org.omg.CORBA.portable.OutputStream源码实例Demo

下面列出了怎么用org.omg.CORBA.portable.OutputStream的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
/**
 * 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();
    }
}
 
源代码2 项目: openjdk-jdk9   文件: CDROutputStream_1_0.java
public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {

        byte[] buf = null;

        if (bbwi.byteBuffer.hasArray())
        {
            buf = bbwi.byteBuffer.array();
        }
        else
        {
            int size = bbwi.position();
            buf = new byte[size];
            // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
            // faster than ByteBuffer.get(byte[], offset, length)
            for (int i = 0; i < size; i++)
                buf[i] = bbwi.byteBuffer.get(i);
        }

        s.write_long(bbwi.position());
        s.write_octet_array(buf, 0, bbwi.position());

    }
 
源代码3 项目: JDKSourceCode1.8   文件: AnyImpl.java
/**
 * 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();
    }
}
 
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
源代码5 项目: openjdk-jdk9   文件: AnyImpl.java
/**
 * returns an input stream that an Any value can be marshaled out of.
 *
 * @return          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();
    }
}
 
源代码6 项目: hottub   文件: StubIORImpl.java
public StubIORImpl( org.omg.CORBA.Object obj )
{
    // write the IOR to an OutputStream and get an InputStream
    OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream();
    ostr.write_Object(obj);
    InputStream istr = ostr.create_input_stream();

    // read the IOR components back from the stream
    int typeLength = istr.read_long();
    typeData = new byte[typeLength];
    istr.read_octet_array(typeData, 0, typeLength);
    int numProfiles = istr.read_long();
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = istr.read_long();
        profileData[i] = new byte[istr.read_long()];
        istr.read_octet_array(profileData[i], 0, profileData[i].length);
    }
}
 
源代码7 项目: cxf   文件: CorbaObjectWriterTest.java
@Test
public void testWriteArray() {
    int[] data = {1, 1, 2, 3, 5, 8, 13, 21};

    // create an array of longs
    QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
    QName arrayIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "array", CorbaConstants.NP_WSDL_CORBA);
    Array arrayType = new Array();
    arrayType.setBound(data.length);
    arrayType.setElemtype(longIdlType);
    // name and respoitory ID of the array are not needed for this test

    // build the object holder for an array.
    TypeCode arrayTC = orb.create_array_tc(data.length, orb.get_primitive_tc(TCKind.tk_long));
    CorbaArrayHandler obj = new CorbaArrayHandler(new QName("Array"), arrayIdlType, arrayTC, arrayType);
    for (int i = 0; i < data.length; ++i) {
        CorbaPrimitiveHandler nestedObj =
            new CorbaPrimitiveHandler(new QName("item"), longIdlType,
                                  orb.get_primitive_tc(TCKind.tk_long), null);
        nestedObj.setValueFromData(Integer.toString(data[i]));
        obj.addElement(nestedObj);
    }

    OutputStream oStream = orb.create_output_stream();
    CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
    writer.writeArray(obj);

    InputStream iStream = oStream.create_input_stream();
    for (int i = 0; i < data.length; ++i) {
        int val = iStream.read_long();
        assertTrue(val == data[i]);
    }
}
 
源代码8 项目: cxf   文件: CorbaStreamableImpl.java
public void _write(OutputStream ostream) {
    try {
        CorbaObjectWriter writer = new CorbaObjectWriter(ostream);
        writer.write(value);
    } catch (java.lang.Exception ex) {
        throw new CorbaBindingException("Error writing streamable value", ex);
    }
}
 
源代码9 项目: TencentKona-8   文件: DynAnyConstructedImpl.java
protected boolean initializeAnyFromComponents() {
    //System.out.println(this + " initializeAnyFromComponents");
    OutputStream out = any.create_output_stream();
    for (int i=0; i<components.length; i++) {
        if (components[i] instanceof DynAnyImpl) {
            ((DynAnyImpl)components[i]).writeAny(out);
        } else {
            // Not our implementation. Nothing we can do to prevent copying.
            components[i].to_any().write_value(out);
        }
    }
    any.read_value(out.create_input_stream(), any.type());
    return true;
}
 
源代码10 项目: hottub   文件: AnyImpl.java
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码11 项目: JDKSourceCode1.8   文件: ORBUtility.java
/**
 * Static method for writing a CORBA standard exception to a stream.
 * @param strm The OutputStream to use for marshaling.
 */
public static void writeSystemException(SystemException ex, OutputStream strm)
{
    String s;

    s = repositoryIdOf(ex.getClass().getName());
    strm.write_string(s);
    strm.write_long(ex.minor);
    strm.write_long(ex.completed.value());
}
 
源代码12 项目: hottub   文件: CorbaServerRequestDispatcherImpl.java
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
源代码13 项目: openjdk-jdk9   文件: SpecialMethod.java
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    if ((servant == null) || (servant instanceof NullServant)) {
        ORB orb = (ORB)request.getBroker() ;
        ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
            CORBALogDomains.OA_INVOCATION ) ;

        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.badSkeleton(), null);
    }

    String[] ids = objectAdapter.getInterfaces( servant, objectId );
    String clientId =
        ((InputStream)request.getInputObject()).read_string();
    boolean answer = false;
    for(int i = 0; i < ids.length; i++)
        if (ids[i].equals(clientId)) {
            answer = true;
            break;
        }

    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(answer);
    return response;
}
 
源代码14 项目: openjdk-8   文件: AnyImpl.java
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);
    }
}
 
/** Write the state to the OutputStream.
 */
public void _write( OutputStream os )
{
    org.omg.CORBA_2_3.portable.OutputStream ostr =
        (org.omg.CORBA_2_3.portable.OutputStream)os ;

    iorTemplate.write( ostr ) ;
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码17 项目: openjdk-8   文件: ORBUtility.java
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: Util.java
/**
 * Writes any java.lang.Object as a CORBA any.
 * @param out the stream in which to write the any.
 * @param obj the object to write as an any.
 */
public static void writeAny(OutputStream out, Object obj) {

    if (utilDelegate != null) {
        utilDelegate.writeAny(out, obj);
    }
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码20 项目: openjdk-8-source   文件: DynAnyConstructedImpl.java
protected void writeAny(OutputStream out) {
    // If all we got is TypeCode representation (no value)
    // then we don't want to force creating a default value
    //System.out.println(this + " checkInitAny before writeAny");
    checkInitAny();
    super.writeAny(out);
}
 
源代码21 项目: jdk1.8-source-analysis   文件: Util.java
/**
 * Writes any java.lang.Object as a CORBA any.
 * @param out the stream in which to write the any.
 * @param obj the object to write as an any.
 */
public void writeAny( org.omg.CORBA.portable.OutputStream out,
                     java.lang.Object obj)
{
    org.omg.CORBA.ORB orb = out.orb();

    // Create Any
    Any any = orb.create_any();

    // Make sure we have a connected object...
    java.lang.Object newObj = Utility.autoConnect(obj,orb,false);

    if (newObj instanceof org.omg.CORBA.Object) {
        any.insert_Object((org.omg.CORBA.Object)newObj);
    } else {
        if (newObj == null) {
            // Handle the null case, including backwards
            // compatibility issues
            any.insert_Value(null, createTypeCodeForNull(orb));
        } else {
            if (newObj instanceof Serializable) {
                // If they're our Any and ORB implementations,
                // we may want to do type code related versioning.
                TypeCode tc = createTypeCode((Serializable)newObj, any, orb);
                if (tc == null)
                    any.insert_Value((Serializable)newObj);
                else
                    any.insert_Value((Serializable)newObj, tc);
            } else if (newObj instanceof Remote) {
                ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
            } else {
                ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
            }
        }
    }

    out.write_any(any);
}
 
源代码22 项目: openjdk-jdk9   文件: AnyImpl.java
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码23 项目: openjdk-jdk8u   文件: CorbaClientDelegateImpl.java
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
源代码24 项目: openjdk-jdk8u   文件: DynAnyConstructedImpl.java
protected void writeAny(OutputStream out) {
    // If all we got is TypeCode representation (no value)
    // then we don't want to force creating a default value
    //System.out.println(this + " checkInitAny before writeAny");
    checkInitAny();
    super.writeAny(out);
}
 
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
源代码26 项目: TencentKona-8   文件: AnyImpl.java
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
源代码28 项目: openjdk-jdk9   文件: AnyImpl.java
static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码29 项目: jdk8u60   文件: AnyImpl.java
static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
源代码30 项目: openjdk-jdk9   文件: ORBUtility.java
/**
 * Static method for writing a CORBA standard exception to a stream.
 * @param strm The OutputStream to use for marshaling.
 */
public static void writeSystemException(SystemException ex, OutputStream strm)
{
    String s;

    s = repositoryIdOf(ex.getClass().getName());
    strm.write_string(s);
    strm.write_long(ex.minor);
    strm.write_long(ex.completed.value());
}
 
 类所在包
 类方法
 同包方法