Java Code Examples for org.omg.IOP.CodecPackage.FormatMismatch

The following are top voted examples for showing how to use org.omg.IOP.CodecPackage.FormatMismatch. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: javify   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Project: javify   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Project: jvm-stm   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 4
Project: jvm-stm   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 5
Project: JamVM-PH   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 6
Project: JamVM-PH   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 7
Project: UniversityCP   File: Problema.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 8
Project: classpath   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 9
Project: classpath   File: CdrEncapsCodecImpl.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: OpenJSharp   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 11
Project: OpenJSharp   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 12
Project: openjdk-jdk10   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 13
Project: openjdk-jdk10   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 14
Project: openjdk9   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 15
Project: openjdk9   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 16
Project: lookaside_java-1.8.0-openjdk   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 17
Project: lookaside_java-1.8.0-openjdk   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 18
Project: jdk8u_corba   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 19
Project: jdk8u_corba   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 20
Project: infobip-open-jdk-8   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 21
Project: infobip-open-jdk-8   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 22
Project: openjdk-source-code-learn   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 23
Project: openjdk-source-code-learn   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 24
Project: OLD-OpenJDK8   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 25
Project: OLD-OpenJDK8   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 26
Project: openjdk-orb   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 27
Project: openjdk-orb   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 28
Project: openjdk-icedtea7   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 29
Project: openjdk-icedtea7   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * 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 );
}
 
Example 30
Project: javify   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 31
Project: javify   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 32
Project: jvm-stm   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 33
Project: jvm-stm   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 34
Project: JamVM-PH   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 35
Project: JamVM-PH   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 36
Project: classpath   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;
 
Example 37
Project: classpath   File: CodecOperations.java   View source code 2 votes vote down vote up
/**
 * 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;