当前位置: 首页>>代码示例>>Java>>正文


Java EncapsOutputStream.toByteArray方法代码示例

本文整理汇总了Java中com.sun.corba.se.impl.encoding.EncapsOutputStream.toByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java EncapsOutputStream.toByteArray方法的具体用法?Java EncapsOutputStream.toByteArray怎么用?Java EncapsOutputStream.toByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.corba.se.impl.encoding.EncapsOutputStream的用法示例。


在下文中一共展示了EncapsOutputStream.toByteArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addExceptionDetailMessage

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CorbaMessageMediatorImpl.java

示例2: addExceptionDetailMessage

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
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 =
        new EncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:18,代码来源:CorbaMessageMediatorImpl.java

示例3: write

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
/** 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ServiceContext.java

示例4: encodeImpl

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:CDREncapsCodec.java

示例5: getBytes

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
    write( os ) ;
    return os.toByteArray() ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ObjectKeyImpl.java

示例6: write

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
/** 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 = new EncapsOutputStream( (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);
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:16,代码来源:ServiceContext.java

示例7: encodeImpl

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
/**
 * 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 = new EncapsOutputStream(
        (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();
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:40,代码来源:CDREncapsCodec.java

示例8: getBytes

import com.sun.corba.se.impl.encoding.EncapsOutputStream; //导入方法依赖的package包/类
public byte[] getBytes( org.omg.CORBA.ORB orb )
{
    EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
    write( os ) ;
    return os.toByteArray() ;
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:7,代码来源:ObjectKeyImpl.java


注:本文中的com.sun.corba.se.impl.encoding.EncapsOutputStream.toByteArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。