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


Java EncapsOutputStream.write_TypeCode方法代码示例

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


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

示例1: 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

示例2: 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


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