Package org.jacorb.orb

Examples of org.jacorb.orb.CDRInputStream


        for( int i = 0; i < contexts.length; i++ )
        {
            if( contexts[i].context_id == TAG_CODE_SETS.value )
            {
                // TAG_CODE_SETS found, demarshall
                CDRInputStream is =
                new CDRInputStream( (org.omg.CORBA.ORB) null,
                                    contexts[i].context_data );
                is.openEncapsulatedArray();

                return CodeSetContextHelper.read( is );
            }
        }
View Full Code Here


        assertTrue(tc.equivalent(ComplexCHelper.type()));
    }

    private TypeCode readTypeCode(CDROutputStream out)
    {
        CDRInputStream in = (CDRInputStream) out.create_input_stream();
        TypeCode tc = in.read_TypeCode();
        return tc;
    }
View Full Code Here

    {
        CDROutputStream out = (CDROutputStream) orb.create_output_stream();

        BothHelper.write(out, both);

        CDRInputStream in = new CDRInputStream(orb, out.getBufferCopy());
        Both copy = BothHelper.read(in);

        FirstHelper.extract(copy.first_any);
        SecondHelper.extract(copy.second_any);
View Full Code Here

        RecursiveBHelper.insert(both.first_any, recB);
        RecursiveCHelper.insert(both.second_any, recC);

        BothHelper.write(out, both);

        CDRInputStream in = new CDRInputStream(orb, out.getBufferCopy());
        Both copy = BothHelper.read(in);

        assertTrue(RecursiveBHelper.type().equivalent(copy.first_any.type()));
        assertTrue(RecursiveCHelper.type().equivalent(copy.second_any.type()));
    }
View Full Code Here

        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();
        in.close();
        return result;
    }
View Full Code Here

        }
    }

    private BiDirIIOPServiceContext readBiDirContext(ServiceContext ctx)
    {
        final CDRInputStream cdr_in =
            new CDRInputStream( orb, ctx.context_data );

        try
        {
            cdr_in.openEncapsulatedArray();

            return BiDirIIOPServiceContextHelper.read(cdr_in);
        }
        finally
        {
            cdr_in.close();
        }
    }
View Full Code Here

           }

           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

       {
           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

           {
               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

            catch (IOException se)
            {
               throw to_COMM_FAILURE (se);
            }
            // the packet was received successfully.
            CDRInputStream in = new CDRInputStream (configuration.getORB (), packet.getData ());

            // Read the header
            //
            // Manually read in the stream rather than using the generated
            // PacketHeader_1_0Helper
            // as we may need to alter endian half way through.
            org.omg.MIOP.PacketHeader_1_0 header = new org.omg.MIOP.PacketHeader_1_0 ();
            header.magic = new char[4];
            in.read_char_array (header.magic, 0, 4);

            // Verify the message is MIOP
            if ( ! MulticastUtil.matchMIOPMagic (header.magic))
            {
               // if it isn't a MIOP message I can ignore it
               continue;
            }

            // We know it is MIOP from now on.
            header.hdr_version = in.read_octet ();
            header.flags = in.read_octet ();

            // Set endian for the stream
            in.setLittleEndian ((0x01 & header.flags) != 0);

            header.packet_length = in.read_ushort ();
            header.packet_number = in.read_ulong ();
            header.number_of_packets = in.read_ulong ();
            header.Id = org.omg.MIOP.UniqueIdHelper.read (in);

            int pos = in.get_pos ();
            // difference to next MulticastUtil.BOUNDARY (which is an 8 byte boundary)
            int header_padding = MulticastUtil.BOUNDARY - (pos % MulticastUtil.BOUNDARY);
            header_padding = (header_padding == MulticastUtil.BOUNDARY) ? 0 : header_padding;

            // skip header_padding bytes anyway, because if no body is
            // present, nobody will try to read it
            in.skip (header_padding);

            // read the GIOP data
            byte data[] = new byte[header.packet_length];
            if (in.available () < data.length)
            {
               throw new MARSHAL
               (
                  "Impossible length in MIOP header. Header denotes length of " +
                  header.packet_length +
                  " but only " +
                  in.available () +
                  " is available."
               );
            }
            in.read_octet_array (data, 0, header.packet_length);

            String messageId = new String (header.Id);
            FragmentedMessage message = incompleteMessages.get (messageId);

            // verify if it's the first message to arrive
View Full Code Here

TOP

Related Classes of org.jacorb.orb.CDRInputStream

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.