@SuppressWarnings("deprecation") @Override public void readFields(DataInput in) throws IOException { if (in.readBoolean()) { modify(decode(in.readInt())); } else { setNull(); } }
@SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a float field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readInt(bytes, offset + 1))); return 4 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a float field ({0})", "invalid length")); } }