Package org.jacorb.orb

Examples of org.jacorb.orb.CDROutputStream


       final org.omg.CORBA.portable.OutputStream out;
       final boolean[] success = new boolean[1];

       if (arguments.contains("deprecated"))
       {
           out = new CDROutputStream(org.omg.CORBA.ORB.init((String[])null, null))
           {
               public void write_fixed(BigDecimal value, short digits, short scale)
               {
                   fail("generated code should invoke deprecated write_fixed method");
               }

               public void write_fixed(BigDecimal b)
               {
                   success[0] = true;
               }
           };
       }
       else
       {
           out = new CDROutputStream(org.omg.CORBA.ORB.init((String[])null, null))
           {
               public void write_fixed(BigDecimal value, short digits, short scale)
               {
                   success[0] = true;
               }
View Full Code Here


        byte []result = null;

        ObjectImpl o = (ObjectImpl)ri.effective_target();

        // This part is proprietary code to marshal the service context data
        CDROutputStream os = new CDROutputStream ();
        if (o._is_local())
        {
            os.write_boolean (true);
        }
        else
        {
            os.write_boolean (false);
        }
        result = os.getBufferCopy();
        os.close();
        // End

        ri.add_request_service_context
            (new ServiceContext (BugJac182Test.svcID, result), true);
    }
View Full Code Here

        assertSame(marshal(""), marshal(""));
    }

    private String marshal(String input)
    {
        CDROutputStream out = (CDROutputStream) orb.create_output_stream();
        out.write_string(input);

        byte[] buffer = out.getBufferCopy();

        CDRInputStream in = new CDRInputStream(buffer);
        String result = in.read_string();
        return result;
    }
View Full Code Here

        return result;
    }

    public void testStringMayNotBeSizeZero()
    {
        CDROutputStream out = (CDROutputStream) orb.create_output_stream();
        out.write_long(0);

        InputStream in = out.create_input_stream();

        try
        {
            in.read_string();
            fail();
View Full Code Here

        }
    }

    public void testEmptyStringMustBeTerminated()
    {
        CDROutputStream out = (CDROutputStream) orb.create_output_stream();
        out.write_long(1);

        InputStream in = out.create_input_stream();

        try
        {
            in.read_string();
            fail();
View Full Code Here

        }
    }

    public void testEmptyStringMustBeTerminatedWithZeroOctet()
    {
        CDROutputStream out = (CDROutputStream) orb.create_output_stream();
        out.write_long(1);
        out.write_octet((byte) 1);
        InputStream in = out.create_input_stream();

        try
        {
            in.read_string();
            fail();
View Full Code Here

    }


    private static TaggedComponent createTlsTransportMech( short targetSupports, short targetRequires, int port )
    {
        CDROutputStream out = new CDROutputStream();
        try
        {
            out.beginEncapsulatedArray();
            TLS_SEC_TRANS tls = new TLS_SEC_TRANS( targetSupports, targetRequires, new TransportAddress[] { new TransportAddress( "local", (short) (port & 0x0ffff) )} );
            TLS_SEC_TRANSHelper.write( out, tls );
            return new TaggedComponent( TAG_TLS_SEC_TRANS.value, out.getBufferCopy() );
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

            // The CDROutputStream only does big endian currently.
            throw new BAD_PARAM("We can only marshal big endian stylee profiles !!");
        }

        // Start a CDR encapsulation for the profile_data
        CDROutputStream profileDataStream = new CDROutputStream();
        try
        {
            profileDataStream.beginEncapsulatedArray();

            // Write the opaque AddressProfile bytes for this profile...
            writeAddressProfile(profileDataStream);

            // ... then the object key
            profileDataStream.write_long(objectKey.length);
            profileDataStream.write_octet_array(objectKey,0,objectKey.length);

            switch( version.minor )
            {
                case 0 :
                    // For GIOP 1.0 there were no tagged components
                    break;
                default :
                    // Assume minor != 0 means 1.1 onwards and encode the TaggedComponents
                    if (compSeq == null)
                    {
                        compSeq = new TaggedComponentSeqHolder (new TaggedComponent[0]);
                    }
                // Write the length of the TaggedProfile sequence.
                profileDataStream.write_long(this.components.size() + compSeq.value.length);

                // Write the TaggedProfiles (ours first, then the ORB's)
                for (int i = 0; i < this.components.asArray().length; i++)
                {
                    TaggedComponentHelper.write(profileDataStream, this.components.asArray()[i]);
                }
                for (int i = 0; i < compSeq.value.length; i++)
                {
                    TaggedComponentHelper.write(profileDataStream, compSeq.value[i]);
                }
            }

            // Populate the TaggedProfile for return.
            tagged_profile.value = new TaggedProfile
            (
                    this.tag(),
                    profileDataStream.getBufferCopy()
            );
        }
        finally
        {
            profileDataStream.close();
        }
    }
View Full Code Here

    public abstract void write (CDROutputStream s);

    public byte [] toCDR ()
    {
        CDROutputStream out = new CDROutputStream();
        try
        {
            out.beginEncapsulatedArray();
            this.write(out);
            return out.getBufferCopy();
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

                CompoundSecMechList compoundSecMechList =
                    new CompoundSecMechList(useStateful, compoundSecMech);

                // export to tagged component
                final CDROutputStream sasDataStream = new CDROutputStream( orb );

                try
                {
                    sasDataStream.beginEncapsulatedArray();
                    CompoundSecMechListHelper.write( sasDataStream , compoundSecMechList );
                    taggedComponent = new TaggedComponent( TAG_CSI_SEC_MECH_LIST.value,
                            sasDataStream.getBufferCopy() );
                }
                finally
                {
                    sasDataStream.close();
                }
            }

            info.add_ior_component_to_profile (taggedComponent, TAG_INTERNET_IOP.value);
        }
View Full Code Here

TOP

Related Classes of org.jacorb.orb.CDROutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.