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