@SuppressWarnings("deprecation") @Override public void readFields(DataInput in) throws IOException { if (in.readBoolean()) { modify(in.readLong() + Long.MIN_VALUE); } 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 long field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(ByteArrayUtil.readLong(bytes, offset + 1) + Long.MIN_VALUE); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a long field ({0})", "invalid length")); } }
@SuppressWarnings("deprecation") private void fill0(LongOption option, boolean doRecover) throws CsvFormatException { if (lineBuffer.hasRemaining()) { try { long value = Long.parseLong(lineBuffer.toString()); option.modify(value); } catch (NumberFormatException e) { if (doRecover && trimWhitespaces()) { fill0(option, false); return; } throw new CsvFormatException(createStatusInLine(Reason.INVALID_CELL_FORMAT, "long value"), e); } } else { option.setNull(); } }
emitter.endRecord(); value.setNull(); emitter.emit(value); value.modify(Long.MAX_VALUE);