コード例 #1
0
ファイル: CsvParser.java プロジェクト: akirakw/asakusafw
  /**
   * Creates a new instance.
   *
   * @param stream the source stream
   * @param path the source path
   * @param config current configuration
   * @throws IllegalArgumentException if some parameters were {@code null}
   */
  public CsvParser(InputStream 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.reader = new InputStreamReader(stream, config.getCharset());
    this.path = path;
    this.separator = config.getSeparatorChar();
    this.trueFormat = config.getTrueFormat();
    this.dateFormat = DateFormatter.newInstance(config.getDateFormat());
    this.dateTimeFormat = DateTimeFormatter.newInstance(config.getDateTimeFormat());
    this.headerCellsFormat = config.getHeaderCells();
    this.forceConsumeHeader = config.isForceConsumeHeader();
    this.allowLineBreakInValue = config.isLineBreakInValue();

    readerBuffer.clear();
    readerBuffer.flip();
  }