Package org.jacorb.orb

Examples of org.jacorb.orb.CDROutputStream


    * @return an Any that holds a copy of this union
    */
   public org.omg.CORBA.Any to_any()
   {
       checkDestroyed ();
       final CDROutputStream out = new CDROutputStream(orb);

       try
       {
           out.write_value( discriminator.type(),
                   discriminator.create_input_stream() );

           out.write_value( member.type(),
                   member.to_any().create_input_stream());

           org.omg.CORBA.Any out_any = orb.create_any();

           out_any.type( type() );
           final CDRInputStream in = new CDRInputStream( orb, out.getBufferCopy());

           try
           {
               out_any.read_value( in, type());
               return out_any;
           }
           finally
           {
               in.close();
           }
       }
       finally
       {
           out.close();
       }
   }
View Full Code Here



   public org.omg.CORBA.Any to_any()
   {
       checkDestroyed ();
       final CDROutputStream out = new CDROutputStream(orb);
       try
       {
           out.write_long( enumValue );

           org.omg.CORBA.Any out_any = orb.create_any();
           out_any.type(type());
           final CDRInputStream in = new CDRInputStream(orb, out.getBufferCopy());

           try
           {
               out_any.read_value( in, type());
               return out_any;
           }
           finally
           {
               in.close();
           }
       }
       finally
       {
           out.close();
       }
   }
View Full Code Here

   {
       checkDestroyed ();
       final org.omg.CORBA.Any out_any = orb.create_any();
       out_any.type( type());

       final CDROutputStream out = new CDROutputStream(orb);

       try
       {
           for( int i = 0; i < limit; i++)
           {
               out.write_value( elementType,
                       members[i].create_input_stream());
           }

           final CDRInputStream in = new CDRInputStream(orb, out.getBufferCopy());
           try
           {
               out_any.read_value( in, type());
               return out_any;
           }
           finally
           {
               in.close();
           }
       }
       finally
       {
           out.close();
       }
   }
View Full Code Here

                BiDirIIOPServiceContext b =
                    new BiDirIIOPServiceContext( points );
                org.omg.CORBA.Any any = orb.create_any();
                BiDirIIOPServiceContextHelper.insert( any, b );

                final CDROutputStream cdr_out = new CDROutputStream(orb);

                try
                {
                    cdr_out.beginEncapsulatedArray();
                    BiDirIIOPServiceContextHelper.write( cdr_out, b );

                    bidir_ctx = new ServiceContext( BI_DIR_IIOP.value,
                            cdr_out.getBufferCopy() );
                }
                finally
                {
                    cdr_out.close();
                }
            }

            ri.add_request_service_context( bidir_ctx, true );
View Full Code Here

        return (PolicyValue[])list.toArray (new PolicyValue[list.size()]);
    }

    private ServiceContext createInvocationPolicies()
    {
        final CDROutputStream out = new CDROutputStream();

        try
        {
            out.beginEncapsulatedArray();
            PolicyValueSeqHelper.write(out, getTimingPolicyValues());
            return new ServiceContext (INVOCATION_POLICIES.value,
                    out.getBufferCopy());
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

    }

    public static ServiceContext createCodesetContext( CodeSet tcs, CodeSet tcsw )
    {
        // encapsulate context
        final CDROutputStream os = new CDROutputStream();
        try
        {
            os.beginEncapsulatedArray();
            CodeSetContextHelper.write( os, new CodeSetContext( tcs.getId(), tcsw.getId() ));

            return new ServiceContext( TAG_CODE_SETS.value, os.getBufferCopy() );
        }
        finally
        {
            os.close();
        }
    }
View Full Code Here

        {
            org.omg.CORBA.Any any = orb.create_any();

            // create the output stream for the result

            CDROutputStream _out = ((CDROutputStream)any.create_output_stream());

            // get a copy of the content of this reply
            byte[] result_buf = out.getBody();

            // ... and insert it
            _out.setBuffer( result_buf  );
            // important: set the _out buffer's position to the end of the contents!
            _out.skip( result_buf.length );
            return any;
        }
        return result;
    }
View Full Code Here

    }

    public byte[] encode_value(Any data)
        throws InvalidTypeForEncoding
    {
        final CDROutputStream out = new CDROutputStream(orb);

        try
        {
            out.setGIOPMinor( giopMinor );

            out.beginEncapsulatedArray();
            data.write_value(out);

            /*
             closing must not be done, since it will patch the
             array with a size!

             try
             {
             out.endEncapsulation();
             }
             catch (java.io.IOException e)
             {
             }
             */

            /*
             * We have to copy anyway since we need an exact-sized array.
             * Closing afterwards, to return buffer to BufferManager.
             */
            byte[] result = out.getBufferCopy();

            return result;
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

     * Creates a ServiceContext for transmitting an exception detail message,
     * as per section 1.15.2 of the Java Mapping.
     */
    public static ServiceContext createExceptionDetailMessage (String message)
    {
        final CDROutputStream out = new CDROutputStream();

        try
        {
            out.beginEncapsulatedArray();
            out.write_wstring(message);
            return new ServiceContext(org.omg.IOP.ExceptionDetailMessage.value,
                    out.getBufferCopy());
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

    }

    public byte[] encode_value(Any data)
        throws InvalidTypeForEncoding
    {
        final CDROutputStream out = new CDROutputStream(orb);

        try
        {

            out.beginEncapsulatedArray();
            data.write_value(out);

            // do not end encapsulation since it will patch the
            // array with a size!

            return  out.getBufferCopy();
        }
        finally
        {
            out.close();
        }
    }
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.