@Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        type = in.readByte();
        switch (type) {
            case BIG_MONEY: {
                object = readBigMoney(in);
                return;
            }
            case MONEY: {
                object = new Money(readBigMoney(in));
                return;
            }
            case CURRENCY_UNIT: {
                object = readCurrency(in);
                return;
            }
        }
        throw new StreamCorruptedException("Serialization input has invalid type");
    }
@ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { type = in . readByte ( ) ; switch ( type ) { case BIG_MONEY : { object = readBigMoney ( in ) ; return ; } case MONEY : { object = new Money ( readBigMoney ( in ) ) ; return ; } case CURRENCY_UNIT : { object = readCurrency ( in ) ; return ; } } throw new StreamCorruptedException ( "Serialization input has invalid type" ) ; }
Outputs the data.

@param in  the input stream
@throws IOException if an error occurs