// a FormatMismatch and a TypeMismatch because we cannot get this
// information from the CDRInputStream. If a RuntimeException occurs,
// it is turned into a FormatMismatch exception.
try {
EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
data.length, giopVersion );
cdrIn.consumeEndian();
// If type code not specified, read it from octet stream:
if( tc == null ) {
tc = cdrIn.read_TypeCode();
}
// Create a new Any object:
any = new AnyImpl( (com.sun.corba.se.spi.orb.ORB)orb );
any.read_value( cdrIn, tc );