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

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

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

    String stringValue = reader.readString();
    assertEquals("String", stringValue);
}
 
Example 2
Source File: ORBUtility.java    From openjdk-jdk9 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 3
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 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 4
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 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 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 6
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 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 7
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 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 8
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 9
Source File: SystemExceptionHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void _write(OutputStream outstream) {
    String id;
    if (value == null) {
        value = new org.omg.CORBA.UNKNOWN();
        id = "IDL:omg.org/CORBA/UNKNOWN";
    } else {
        String className = value.getClass().getName();
        id = "IDL:omg.org/CORBA/"
            + className.substring(className.lastIndexOf('.') + 1) + ":1.0";
    }

    outstream.write_string(id);
    outstream.write_ulong(value.minor);
    outstream.write_ulong(value.completed.value());
}
 
Example 10
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.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 11
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.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 12
Source File: CorbaObjectReaderTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testReadStruct() {
    OutputStream oStream = orb.create_output_stream();

    // create the following struct
    // struct TestStruct {
    //     long member1;
    //     string member2;
    //     boolean member3;
    // }
    int member1 = 12345;
    String member2 = "54321";
    boolean member3 = true;

    oStream.write_long(member1);
    oStream.write_string(member2);
    oStream.write_boolean(member3);

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

    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);
    obj.addMember(
            new CorbaPrimitiveHandler(new QName("member1"), longIdlType, structMembers[0].type, null));
    obj.addMember(
            new CorbaPrimitiveHandler(new QName("member2"), stringIdlType, structMembers[1].type, null));
    obj.addMember(
            new CorbaPrimitiveHandler(new QName("member3"), boolIdlType, structMembers[2].type, null));

    reader.readStruct(obj);

    List<CorbaObjectHandler> nestedObjs = obj.getMembers();
    assertTrue(Integer.parseInt(((CorbaPrimitiveHandler)nestedObjs.get(0)).getDataFromValue())
               == member1);
    assertEquals(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue(), member2);
    assertTrue(Boolean.parseBoolean(((CorbaPrimitiveHandler)nestedObjs.get(2))
                               .getDataFromValue())
               == member3);
}
 
Example 13
Source File: StringHolder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 14
Source File: StringHolder.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 15
Source File: StringHolder.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 16
Source File: StringHolder.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 17
Source File: StringHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 18
Source File: StringHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 19
Source File: StringHolder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}
 
Example 20
Source File: StringHolder.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Marshals the value held by this <code>StringHolder</code> object
 * to the output stream  <code>output</code>.
 *
 * @param output the OutputStream which will contain the CDR formatted data.
 */
public void _write(OutputStream output) {
    output.write_string(value);
}