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

The following examples show how to use org.omg.CORBA.portable.InputStream#read_boolean() . 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 testWriteBoolean() {
    OutputStream oStream = orb.create_output_stream();

    CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
    Boolean boolValue = Boolean.TRUE;
    writer.writeBoolean(boolValue);

    InputStream iStream = oStream.create_input_stream();
    boolean b = iStream.read_boolean();
    assertTrue(b == boolValue.booleanValue());
}
 
Example 2
Source File: CorbaObjectWriterTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testWriteStruct() {
    // create the following struct
    // struct TestStruct {
    //     long member1;
    //     string member2;
    //     boolean member3;
    // }
    int member1 = 12345;
    String member2 = "54321";
    boolean member3 = true;

    QName structIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "struct", CorbaConstants.NP_WSDL_CORBA);
    QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
    QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
    QName boolIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", CorbaConstants.NP_WSDL_CORBA);

    Struct structType = new Struct();
    structType.setName("TestStruct");
    MemberType m1 = new MemberType();
    m1.setIdltype(longIdlType);
    m1.setName("member1");
    MemberType m2 = new MemberType();
    m2.setIdltype(stringIdlType);
    m2.setName("member2");
    MemberType m3 = new MemberType();
    m3.setIdltype(boolIdlType);
    m3.setName("member3");
    structType.getMember().add(m1);
    structType.getMember().add(m2);
    structType.getMember().add(m3);

    // build the object holder
    StructMember[] structMembers = new StructMember[3];
    structMembers[0] = new StructMember("member1", orb.get_primitive_tc(TCKind.tk_long), null);
    structMembers[1] = new StructMember("member2", orb.get_primitive_tc(TCKind.tk_string), null);
    structMembers[2] = new StructMember("member3", orb.get_primitive_tc(TCKind.tk_boolean), null);
    TypeCode structTC = orb.create_struct_tc("IDL:org.apache.cxf.TestStruct/1.0", "TestStruct",
                                             structMembers);
    CorbaStructHandler obj = new CorbaStructHandler(new QName("TestStruct"), structIdlType,
                                                    structTC, structType);
    CorbaPrimitiveHandler memberObj1 =
        new CorbaPrimitiveHandler(new QName("member1"), longIdlType, structMembers[0].type, null);
    CorbaPrimitiveHandler memberObj2 =
        new CorbaPrimitiveHandler(new QName("member2"), stringIdlType, structMembers[1].type, null);
    CorbaPrimitiveHandler memberObj3 =
        new CorbaPrimitiveHandler(new QName("member3"), boolIdlType, structMembers[2].type, null);

    memberObj1.setValueFromData(Integer.toString(member1));
    memberObj2.setValueFromData(member2);
    memberObj3.setValueFromData(Boolean.toString(member3));

    obj.addMember(memberObj1);
    obj.addMember(memberObj2);
    obj.addMember(memberObj3);

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

    InputStream iStream = oStream.create_input_stream();
    int readMember1 = iStream.read_long();
    assertTrue(readMember1 == member1);
    String readMember2 = iStream.read_string();
    assertEquals(readMember2, member2);
    boolean readMember3 = iStream.read_boolean();
    assertTrue(readMember3 == member3);
}
 
Example 3
Source File: BooleanHolder.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 4
Source File: BooleanHolder.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 5
Source File: BooleanHolder.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 6
Source File: BooleanHolder.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 7
Source File: BooleanHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 8
Source File: BooleanHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 9
Source File: BooleanHolder.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from {@code input} and assigns it to this
 * {@code BooleanHolder} object's {@code value} field.
 *
 * @param input the {@code InputStream} object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 10
Source File: BooleanHolder.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 11
Source File: BooleanHolder.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 12
Source File: BooleanHolder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}
 
Example 13
Source File: BooleanHolder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads unmarshalled data from <code>input</code> and assigns it to this
 * <code>BooleanHolder</code> object's <code>value</code> field.
 *
 * @param input the <code>InputStream</code> object containing
 *              CDR formatted data from the wire
 */
public void _read(InputStream input) {
    value = input.read_boolean();
}