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


Java FormatMismatch类代码示例

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


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

示例1: decode

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

import org.omg.IOP.CodecPackage.FormatMismatch; //导入依赖的package包/类
/**
 * Crea una instancia del problema leyendo las ciudades desde la entrada
 * estándar.
 * El formato usado es el siguiente:
 * <pre>{@code
 * DIMENSION: n
 * 1 x1 y1
 * 2 x2 y2
 * .....
 * n xn yn
 * }</pre>
 * Donde 'n' es el número de ciudades que componen el problema.
 * 
 * @return Problema con las ciudades leídas.
 * @throws FormatMismatch Ocurre cuando la primera línea es inválida.
 * La expresión regular a cumple es: DIMENSION\s?:\s*(\d+)
 */
public static Problema FromStdIn() throws FormatMismatch {
    Scanner reader = new Scanner(System.in);
    
    // Primer obtiene el número de ciudades
    String numCiudadesRegex = "DIMENSION\\s?:\\s*(\\d+)";
    reader.findInLine(numCiudadesRegex);
    
    MatchResult result = reader.match();
    if (result.groupCount() != 1)
        throw new FormatMismatch("Invalid format: " + numCiudadesRegex);
    
    // A continuación se leen las ciudades
    String a = result.group(1);
    int numCiudades   = Integer.parseInt(a);
    Ciudad[] ciudades = new Ciudad[numCiudades];
    for (int i = 0; i < numCiudades; i++)
        ciudades[i] = Ciudad.FromStdIn(reader);
    
    return new Problema(ciudades);
}
 
开发者ID:pleonex,项目名称:UniversityCP,代码行数:38,代码来源:Problema.java

示例4: decode

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

示例5: decode_value

import org.omg.IOP.CodecPackage.FormatMismatch; //导入依赖的package包/类
/**
 * Decode the given octet sequence into an any based on a CDR
 * encapsulated octet sequence.  The type code is expected not to appear
 * in the octet sequence, and the given type code is used instead.
 */
public Any decode_value( byte[] data, TypeCode tc )
    throws FormatMismatch, TypeMismatch
{
    if( data == null )
        throw wrapper.nullParam() ;
    if( tc == null )
        throw  wrapper.nullParam() ;
    return decodeImpl( data, tc );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:CDREncapsCodec.java

示例6: decode

import org.omg.IOP.CodecPackage.FormatMismatch; //导入依赖的package包/类
/**
 * Decode the given array of bytes and return the decoded value, inserted
 * into {@link Any}. This methods expects that the byte array contains
 * the CDR-encoded data structure {@link TypeCode}, followed by the data
 * structure itself.
 *
 * @param them an array of bytes to decode.
 * @return the {@link Any}, containing the decoded structure. The structure
 * can be extracted from the Any with the appropriate helper.
 *
 * @throws FormatMismatch on the invalid structure of the byte array.
 *
 * @see #encode(Any)
 */
Any decode(byte[] them)
    throws FormatMismatch;
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:CodecOperations.java

示例7: decode_value

import org.omg.IOP.CodecPackage.FormatMismatch; //导入依赖的package包/类
/**
 * Decode the given array of bytes, supposing that they contain the
 * given data structure, and return the decoded value.
 *
 * @param them the array of bytes to decode. Should contain the data type,
 * matching the structure, defined in the <code>type</code> parameter.
 * Does not contain the typecode itself.
 *
 * @param type the typecode of the data structure, stored in the byte
 * array.
 *
 * @return the {@link Any}, containing the decoded structure. The
 * structure can be extracted from the Any with the appropriate helper.
 *
 * @throws FormatMismatch on the invalid structure of the byte array.
 * @throws TypeMismatch if discovered that the the byte array defines a
 * different structure.
 *
 * @see #encode_value(Any)
 */
Any decode_value(byte[] them, TypeCode type)
          throws FormatMismatch, TypeMismatch;
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:CodecOperations.java


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