com.sun.corba.se.impl.encoding.EncapsOutputStream Java Examples

The following examples show how to use com.sun.corba.se.impl.encoding.EncapsOutputStream. 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: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #2
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #3
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #4
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #5
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #6
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #7
Source File: TaggedComponentBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.IOP.TaggedComponent getIOPComponent(
    org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    return org.omg.IOP.TaggedComponentHelper.read( is ) ;
}
 
Example #8
Source File: OutputStreamFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsOutputStream newEncapsOutputStream(
        final ORB orb, final boolean isLittleEndian) {
    return AccessController.doPrivileged(
        new PrivilegedAction<EncapsOutputStream>() {
            @Override
            public EncapsOutputStream run() {
                return new EncapsOutputStream(
                    (com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian);
            }
    });
}
 
Example #9
Source File: ObjectKeyImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    return os.toByteArray() ;
}
 
Example #10
Source File: OutputStreamFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsOutputStream newEncapsOutputStream(
        final ORB orb, final GIOPVersion giopVersion) {
    return AccessController.doPrivileged(
        new PrivilegedAction<EncapsOutputStream>() {
            @Override
            public EncapsOutputStream run() {
                return new EncapsOutputStream(
                    (com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
            }
    });
}
 
Example #11
Source File: CDREncapsCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example #12
Source File: TaggedComponentBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.IOP.TaggedComponent getIOPComponent(
    org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    return org.omg.IOP.TaggedComponentHelper.read( is ) ;
}
 
Example #13
Source File: CDREncapsCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example #14
Source File: TaggedComponentFactoryFinderImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public TaggedComponent create( org.omg.CORBA.ORB orb,
    org.omg.IOP.TaggedComponent comp )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    // Skip the component ID: we just wrote it out above
    is.read_ulong() ;

    return (TaggedComponent)create( comp.tag, is ) ;
}
 
Example #15
Source File: OutputStreamFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsOutputStream newEncapsOutputStream(
        final ORB orb) {
    return AccessController.doPrivileged(
        new PrivilegedAction<EncapsOutputStream>() {
            @Override
            public EncapsOutputStream run() {
                return new EncapsOutputStream(
                    (com.sun.corba.se.spi.orb.ORB)orb);
            }
    });
}
 
Example #16
Source File: TaggedComponentBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.IOP.TaggedComponent getIOPComponent(
    org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    return org.omg.IOP.TaggedComponentHelper.read( is ) ;
}
 
Example #17
Source File: ServiceContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example #18
Source File: ServiceContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example #19
Source File: ObjectKeyImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    return os.toByteArray() ;
}
 
Example #20
Source File: ObjectKeyImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    return os.toByteArray() ;
}
 
Example #21
Source File: OutputStreamFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsOutputStream newEncapsOutputStream(
        final ORB orb) {
    return AccessController.doPrivileged(
        new PrivilegedAction<EncapsOutputStream>() {
            @Override
            public EncapsOutputStream run() {
                return new EncapsOutputStream(
                    (com.sun.corba.se.spi.orb.ORB)orb);
            }
    });
}
 
Example #22
Source File: EncapsulationUtility.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static public void writeEncapsulation( WriteContents obj,
    OutputStream os )
{
    EncapsOutputStream out =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());

    out.putEndian() ;

    obj.writeContents( out ) ;

    writeOutputStream( out, os ) ;
}
 
Example #23
Source File: IORImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public org.omg.IOP.IOR getIOPIOR() {
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
    write(os);
    InputStream is = (InputStream) (os.create_input_stream());
    return org.omg.IOP.IORHelper.read(is);
}
 
Example #24
Source File: TaggedComponentFactoryFinderImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public TaggedComponent create( org.omg.CORBA.ORB orb,
    org.omg.IOP.TaggedComponent comp )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    // Skip the component ID: we just wrote it out above
    is.read_ulong() ;

    return (TaggedComponent)create( comp.tag, is ) ;
}
 
Example #25
Source File: ObjectKeyImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    return os.toByteArray() ;
}
 
Example #26
Source File: GenericTaggedProfile.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public org.omg.IOP.TaggedProfile getIOPProfile()
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
    write( os ) ;
    InputStream is = (InputStream)(os.create_input_stream()) ;
    return org.omg.IOP.TaggedProfileHelper.read( is ) ;
}
 
Example #27
Source File: EncapsulationUtility.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
static public void writeEncapsulation( WriteContents obj,
    OutputStream os )
{
    EncapsOutputStream out =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());

    out.putEndian() ;

    obj.writeContents( out ) ;

    writeOutputStream( out, os ) ;
}
 
Example #28
Source File: TaggedComponentFactoryFinderImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public TaggedComponent create( org.omg.CORBA.ORB orb,
    org.omg.IOP.TaggedComponent comp )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
    InputStream is = (InputStream)(os.create_input_stream() ) ;
    // Skip the component ID: we just wrote it out above
    is.read_ulong() ;

    return (TaggedComponent)create( comp.tag, is ) ;
}
 
Example #29
Source File: GenericTaggedProfile.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.IOP.TaggedProfile getIOPProfile()
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
    write( os ) ;
    InputStream is = (InputStream)(os.create_input_stream()) ;
    return org.omg.IOP.TaggedProfileHelper.read( is ) ;
}
 
Example #30
Source File: IORImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.IOP.IOR getIOPIOR() {
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
    write(os);
    InputStream is = (InputStream) (os.create_input_stream());
    return org.omg.IOP.IORHelper.read(is);
}