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


Java InvalidTypeForEncoding类代码示例

本文整理汇总了Java中org.omg.IOP.CodecPackage.InvalidTypeForEncoding的典型用法代码示例。如果您正苦于以下问题:Java InvalidTypeForEncoding类的具体用法?Java InvalidTypeForEncoding怎么用?Java InvalidTypeForEncoding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: decode

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/**
 * Decode the contents of the byte array into Any.
 * The byte array may have the optional four byte length indicator
 * in the beginning. If these four bytes are zero, it is assumed,
 * that no length indicator is present.
 */
public Any decode(byte[] them)
           throws FormatMismatch
{
  BufferredCdrInput input = createInput(them);
  BufferredCdrInput encapsulation = createEncapsulation(them, input);

  TypeCode type = encapsulation.read_TypeCode();

  try
    {
      checkTypePossibility("", type);
    }
  catch (InvalidTypeForEncoding ex)
    {
      throw new FormatMismatch(ex.getMessage());
    }

  return readAny(type, encapsulation);
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:CdrEncapsCodecImpl.java

示例2: decode_value

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/**
 * Decode the value, stored in the byte array, into Any, assuming,
 * that the byte array holds the data structure, defined by the
 * given typecode.
 *
 * The byte array may have the optional four byte length indicator
 * in the beginning. If these four bytes are zero, it is assumed,
 * that no length indicator is present.
 */
public Any decode_value(byte[] them, TypeCode type)
                 throws FormatMismatch, TypeMismatch
{
  try
    {
      checkTypePossibility("", type);
    }
  catch (InvalidTypeForEncoding ex)
    {
      throw new TypeMismatch(ex.getMessage());
    }

  BufferredCdrInput input = createInput(them);
  BufferredCdrInput encapsulation = createEncapsulation(them, input);
  return readAny(type, encapsulation);
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:CdrEncapsCodecImpl.java

示例3: encode_value

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/** {@inheritDoc} */
public byte[] encode_value(Any that)
                    throws InvalidTypeForEncoding
{
  checkTypePossibility("", that.type());

  BufferedCdrOutput output = createOutput(that);

  AbstractCdrOutput encapsulation = output.createEncapsulation();

  try
    {
      that.write_value(encapsulation);

      encapsulation.close();
      output.close();
    }
  catch (Exception ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.Encapsulation;
      m.initCause(ex);
      throw m;
    }
  return output.buffer.toByteArray();
}
 
开发者ID:vilie,项目名称:javify,代码行数:27,代码来源:CdrEncapsCodecImpl.java

示例4: encode

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/**
 * Convert the given any into a CDR encapsulated octet sequence
 */
public byte[] encode( Any data )
    throws InvalidTypeForEncoding
{
    if ( data == null )
        throw wrapper.nullParam() ;
    return encodeImpl( data, true );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:CDREncapsCodec.java

示例5: encode_value

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/**
 * Convert the given any into a CDR encapsulated octet sequence.  Only
 * the data is stored.  The type code is not.
 */
public byte[] encode_value( Any data )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;
    return encodeImpl( data, false );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:CDREncapsCodec.java

示例6: encodeImpl

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的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

示例7: encode

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/** {@inheritDoc} */
public byte[] encode(Any that)
              throws InvalidTypeForEncoding
{
  checkTypePossibility("", that.type());

  BufferedCdrOutput output = createOutput(that);

  // BufferedCdrOutput has internal support for this encoding.
  AbstractCdrOutput encapsulation = output.createEncapsulation();

  try
    {
      TypeCodeHelper.write(encapsulation, that.type());
      that.write_value(encapsulation);

      encapsulation.close();
      output.close();
    }
  catch (Exception ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.Encapsulation;
      m.initCause(ex);
      throw m;
    }
  return output.buffer.toByteArray();
}
 
开发者ID:vilie,项目名称:javify,代码行数:29,代码来源:CdrEncapsCodecImpl.java

示例8: checkTypePossibility

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的package包/类
/**
 * Checks if the given type can be encoded. Currently only checks for wide
 * strings and wide chars for GIOP 1.0.
 *
 * @param t a typecode to chek.
 *
 * @throws InvalidTypeForEncoding if the typecode is not valid for the given
 * version.
 */
private void checkTypePossibility(String name, TypeCode t)
                           throws InvalidTypeForEncoding
{
  if (noWide)
    {
      try
        {
          int kind = t.kind().value();

          if (kind == TCKind._tk_wchar || kind == TCKind._tk_wstring)
            throw new InvalidTypeForEncoding(name + " wide char in " +
                                             version
                                            );
          else if (kind == TCKind._tk_alias || kind == TCKind._tk_array ||
                   kind == TCKind._tk_sequence
                  )
            checkTypePossibility("Array member", t.content_type());

          else if (kind == TCKind._tk_struct || kind == TCKind._tk_union)
            {
              for (int i = 0; i < t.member_count(); i++)
                {
                  checkTypePossibility(t.member_name(i), t.member_type(i));
                }
            }
        }
      catch (UserException ex)
        {
          InternalError ierr = new InternalError();
          ierr.initCause(ex);
          throw ierr;
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:44,代码来源:CdrEncapsCodecImpl.java

示例9: encodeImpl

import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; //导入依赖的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


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