/**
   * Write the headers.
   *
   * @param tw The output stream.
   */
  private void writeHeaders(final PrintWriter tw) {
    final StringBuilder line = new StringBuilder();
    for (final AnalystField stat : this.analyst.getScript().getNormalize().getNormalizedFields()) {
      final int needed = stat.getColumnsNeeded();

      for (int i = 0; i < needed; i++) {
        BasicFile.appendSeparator(line, getFormat());
        line.append('\"');
        line.append(CSVHeaders.tagColumn(stat.getName(), i, stat.getTimeSlice(), needed > 1));
        line.append('\"');
      }
    }
    tw.println(line.toString());
  }
Пример #2
0
  /**
   * Add headings for a raw file.
   *
   * @param line The line to write the raw headings to.
   * @param prefix The prefix to place.
   * @param format The format to use.
   */
  public final void addRawHeadings(
      final StringBuilder line, final String prefix, final CSVFormat format) {
    final int subFields = getColumnsNeeded();

    for (int i = 0; i < subFields; i++) {
      final String str = CSVHeaders.tagColumn(this.name, i, this.timeSlice, subFields > 1);
      BasicFile.appendSeparator(line, format);
      line.append('\"');
      if (prefix != null) {
        line.append(prefix);
      }
      line.append(str);
      line.append('\"');
    }
  }