@Override String getPattern() { return next.getPattern(); }
@Override String getPattern() { return next.getPattern(); }
@SuppressWarnings("deprecation") private void fill0(DateOption option, boolean doRecover) throws CsvFormatException { if (lineBuffer.hasRemaining()) { int value = dateFormat.parse(lineBuffer); if (value < 0) { if (doRecover && trimWhitespaces()) { fill0(option, false); return; } throw new CsvFormatException( createStatusInLine(Reason.INVALID_CELL_FORMAT, dateFormat.getPattern()), null); } option.modify(value); } else { option.setNull(); } }
/** * Creates a new instance. * @param stream the target stream * @param path the destination path * @param config current configuration * @throws IllegalArgumentException if some parameters were {@code null} */ public CsvEmitter(OutputStream stream, String path, CsvConfiguration config) { if (stream == null) { throw new IllegalArgumentException("stream must not be null"); //$NON-NLS-1$ } if (config == null) { throw new IllegalArgumentException("config must not be null"); //$NON-NLS-1$ } this.writer = new OutputStreamWriter(stream, config.getCharset()); this.separator = config.getSeparatorChar(); this.escapePattern = Pattern.compile( "[" + ESCAPE + separator + LINE_DELIMITER + "]"); //$NON-NLS-1$ //$NON-NLS-2$ this.trueFormat = escape(config.getTrueFormat()); this.escapeTrue = hasEscapeTarget(config.getTrueFormat()); this.falseFormat = escape(config.getFalseFormat()); this.escapeFalse = hasEscapeTarget(config.getFalseFormat()); this.dateFormat = DateFormatter.newInstance(config.getDateFormat()); this.escapeDate = hasMetaCharacter(dateFormat.getPattern()); this.dateTimeFormat = DateTimeFormatter.newInstance(config.getDateTimeFormat()); this.escapeDateTime = hasMetaCharacter(dateTimeFormat.getPattern()); this.headerCellsFormat = config.getHeaderCells(); this.forceEscapeMask = buildQuoteMask(config.getForceQuoteColumns()); this.columnIndex = 0; }