@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")); } }
@SuppressWarnings("deprecation") private void fill0(FloatOption option, boolean doRecover) throws CsvFormatException { if (lineBuffer.hasRemaining()) { try { float value = Float.parseFloat(lineBuffer.toString()); option.modify(value); } catch (NumberFormatException e) { if (doRecover && trimWhitespaces()) { fill0(option, false); return; } throw new CsvFormatException(createStatusInLine(Reason.INVALID_CELL_FORMAT, "float value"), e); } } else { option.setNull(); } }
emitter.endRecord(); value.setNull(); emitter.emit(value); value.modify(Float.POSITIVE_INFINITY);