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

The following examples show how to use org.omg.CORBA.portable.OutputStream#write_short() . 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: CorbaObjectReaderTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadShort() {
    OutputStream oStream = orb.create_output_stream();
    oStream.write_short((short)-100);

    InputStream iStream = oStream.create_input_stream();
    CorbaObjectReader reader = new CorbaObjectReader(iStream);

    Short shortValue = reader.readShort();
    assertTrue(shortValue.shortValue() == (short)-100);
}
 
Example 2
Source File: CorbaObjectReaderTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testReadException() {
    OutputStream oStream = orb.create_output_stream();

    // create the following exception
    // exception TestExcept {
    //     short code;
    //     string message;
    // }
    short code = 12345;
    String message = "54321";

    oStream.write_string("IDL:org.apache.cxf.TestException/1.0");
    oStream.write_short(code);
    oStream.write_string(message);

    InputStream iStream = oStream.create_input_stream();
    CorbaObjectReader reader = new CorbaObjectReader(iStream);

    QName exceptIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "exception",
                                    CorbaConstants.NP_WSDL_CORBA);
    QName shortIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short",
                                   CorbaConstants.NP_WSDL_CORBA);
    QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string",
                                    CorbaConstants.NP_WSDL_CORBA);

    Exception exceptType = new Exception();
    exceptType.setName("TestException");
    MemberType m1 = new MemberType();
    m1.setIdltype(shortIdlType);
    m1.setName("code");
    MemberType m2 = new MemberType();
    m2.setIdltype(stringIdlType);
    m2.setName("message");
    exceptType.getMember().add(m1);
    exceptType.getMember().add(m2);

    // build the object holder
    StructMember[] exceptMembers = new StructMember[2];
    exceptMembers[0] = new StructMember("code", orb.get_primitive_tc(TCKind.tk_short), null);
    exceptMembers[1] = new StructMember("message", orb.get_primitive_tc(TCKind.tk_string), null);
    TypeCode exceptTC = orb.create_exception_tc("IDL:org.apache.cxf.TestException/1.0", "TestException",
                                                exceptMembers);
    CorbaExceptionHandler obj = new CorbaExceptionHandler(new QName("TestException"), exceptIdlType,
                                                          exceptTC, exceptType);
    obj.addMember(
            new CorbaPrimitiveHandler(new QName("code"), shortIdlType, exceptMembers[0].type, null));
    obj.addMember(
            new CorbaPrimitiveHandler(new QName("message"), stringIdlType, exceptMembers[1].type, null));

    reader.readException(obj);

    List<CorbaObjectHandler> nestedObjs = obj.getMembers();
    assertTrue(Short.parseShort(((CorbaPrimitiveHandler)nestedObjs.get(0))
                             .getDataFromValue()) == code);
    assertEquals(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue(), message);
}
 
Example 3
Source File: ShortHolder.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 4
Source File: ShortHolder.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 5
Source File: ShortHolder.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 6
Source File: ShortHolder.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 7
Source File: ShortHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 8
Source File: ShortHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 9
Source File: ShortHolder.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to {@code output} the value in
 * this {@code ShortHolder} object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 10
Source File: ShortHolder.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 11
Source File: ShortHolder.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 12
Source File: ShortHolder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}
 
Example 13
Source File: ShortHolder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals to <code>output</code> the value in
 * this <code>ShortHolder</code> object.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_short(value);
}