Java Code Examples for org.omg.CORBA.portable.OutputStream#write_long()

The following examples show how to use org.omg.CORBA.portable.OutputStream#write_long() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StubIORImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 2
Source File: StubIORImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 3
Source File: StubIORImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 4
Source File: DynSequenceImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    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;
}
 
Example 5
Source File: ORBUtility.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 6
Source File: ORBUtility.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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));
}
 
Example 7
Source File: DynSequenceImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    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;
}
 
Example 8
Source File: ORBUtility.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 9
Source File: ORBUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 10
Source File: ORBUtility.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 11
Source File: DynSequenceImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    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;
}
 
Example 12
Source File: ORBUtility.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 13
Source File: ORBUtility.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 14
Source File: DynSequenceImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    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;
}
 
Example 15
Source File: DynSequenceImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    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;
}
 
Example 16
Source File: CorbaObjectReaderTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadEnum() {
    OutputStream oStream = orb.create_output_stream();

    // create the following enum
    // enum { RED, GREEN, BLUE };
    oStream.write_long(1);
    InputStream iStream = oStream.create_input_stream();
    CorbaObjectReader reader = new CorbaObjectReader(iStream);

    String[] enums = {"RED", "GREEN", "BLUE" };
    Enum enumType = new Enum();
    Enumerator enumRed = new Enumerator();
    enumRed.setValue(enums[0]);
    Enumerator enumGreen = new Enumerator();
    enumGreen.setValue(enums[1]);
    Enumerator enumBlue = new Enumerator();
    enumBlue.setValue(enums[2]);
    enumType.getEnumerator().add(enumRed);
    enumType.getEnumerator().add(enumGreen);
    enumType.getEnumerator().add(enumBlue);

    // These values don't matter to the outcome of the test but are needed during construction
    QName enumName = new QName("TestEnum");
    QName enumIdlType = new QName("corbatm:TestEnum");
    TypeCode enumTC = orb.create_enum_tc("IDL:TestEnum:1.0", enumName.getLocalPart(), enums);
    CorbaEnumHandler obj = new CorbaEnumHandler(enumName, enumIdlType, enumTC, enumType);

    reader.readEnum(obj);
    assertEquals(obj.getValue(), enums[1]);
}
 
Example 17
Source File: IntHolder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value in this <code>IntHolder</code> object's
 * <code>value</code> field to the output stream <code>output</code>.
 *
 * @param output the <code>OutputStream</code> object that will contain
 *               the CDR formatted data
 */
public void _write(OutputStream output) {
    output.write_long(value);
}
 
Example 18
Source File: IntHolder.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value in this <code>IntHolder</code> object's
 * <code>value</code> field to the output stream <code>output</code>.
 *
 * @param output the <code>OutputStream</code> object that will contain
 *               the CDR formatted data
 */
public void _write(OutputStream output) {
    output.write_long(value);
}
 
Example 19
Source File: IntHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value in this <code>IntHolder</code> object's
 * <code>value</code> field to the output stream <code>output</code>.
 *
 * @param output the <code>OutputStream</code> object that will contain
 *               the CDR formatted data
 */
public void _write(OutputStream output) {
    output.write_long(value);
}
 
Example 20
Source File: IntHolder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value in this <code>IntHolder</code> object's
 * <code>value</code> field to the output stream <code>output</code>.
 *
 * @param output the <code>OutputStream</code> object that will contain
 *               the CDR formatted data
 */
public void _write(OutputStream output) {
    output.write_long(value);
}