Java Code Examples for org.omg.CORBA.portable.InputStream#read_short()

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

    CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
    Short shortValue = Short.valueOf((short)-123);
    writer.writeShort(shortValue);

    InputStream iStream = oStream.create_input_stream();
    short s = iStream.read_short();
    assertTrue(s == shortValue.shortValue());
}
 
Example 2
Source File: CorbaObjectWriterTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testWriteException() {
    // create the following exception
    // exception TestExcept {
    //     short code;
    //     string message;
    // }
    short code = 12345;
    String message = "54321";
    String reposID = "IDL:org.apache.cxf.TestException/1.0";

    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");
    exceptType.setRepositoryID(reposID);
    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(reposID, "TestException", exceptMembers);
    CorbaExceptionHandler obj = new CorbaExceptionHandler(new QName("TestException"), exceptIdlType,
                                                          exceptTC, exceptType);

    CorbaPrimitiveHandler member1 =
        new CorbaPrimitiveHandler(new QName("code"), shortIdlType, exceptMembers[0].type, null);
    member1.setValueFromData(Short.toString(code));
    CorbaPrimitiveHandler member2 =
        new CorbaPrimitiveHandler(new QName("message"), stringIdlType, exceptMembers[1].type, null);
    member2.setValueFromData(message);
    obj.addMember(member1);
    obj.addMember(member2);

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

    InputStream iStream = oStream.create_input_stream();

    String readId = iStream.read_string();
    assertEquals(readId, reposID);
    short readCode = iStream.read_short();
    assertTrue(readCode == code);
    String readMessage = iStream.read_string();
    assertEquals(readMessage, message);
}
 
Example 3
Source File: ShortHolder.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 4
Source File: ShortHolder.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 5
Source File: ShortHolder.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 6
Source File: ShortHolder.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 7
Source File: ShortHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 8
Source File: ShortHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 9
Source File: ShortHolder.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from {@code input} and initalizes the value in
 * this {@code ShortHolder} object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 10
Source File: ShortHolder.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 11
Source File: ShortHolder.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 12
Source File: ShortHolder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}
 
Example 13
Source File: ShortHolder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads from <code>input</code> and initalizes the value in
 * this <code>ShortHolder</code> object
 * with the unmarshalled data.
 *
 * @param input the InputStream containing CDR formatted data from the wire.
 */
public void _read(InputStream input) {
    value = input.read_short();
}