/** * Read the value of the given type from the given stream. * * @param input a stream to read from. * @param a_type a typecode of the value to read. */ public void read_value(org.omg.CORBA.portable.InputStream input, TypeCode a_type ) throws MARSHAL { try { int kind = a_type.kind().value(); // Fixed needs special handling. if (kind == TCKind._tk_fixed) { BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale()); has = new FixedHolder(dec); } else { has = HolderLocator.createHolder(a_type); if (has == null) { // Use the Universal Holder that reads till the end of stream. // This works with the extract/insert pair of the typical // Helper. BufferedCdrOutput buffer = new BufferedCdrOutput(); buffer.setOrb(orb); has = new GeneralHolder(buffer); } } type(a_type); if (!(has instanceof GeneralHolder) && (kind == TCKind._tk_value_box)) { // The streamable only contains operations for // reading the value, not the value header. Field vField = has.getClass().getField("value"); Object content = Vio.read(input, a_type.id()); vField.set(has, content); } else has._read(input); } catch (Exception ex) { MARSHAL m = new MARSHAL(); m.minor = Minor.Any; m.initCause(ex); throw m; } }
/** * Extract the previously inserted CORBA <code>fixed</code>/ * @return the previously inserted value. * * @throws org.omg.CORBA.BAD_OPERATION if the holder contains something * else than BigDecimal. */ public BigDecimal extract_fixed() throws org.omg.CORBA.BAD_OPERATION { check(TCKind._tk_fixed); return ((FixedHolder) has).value; }