@Test public void testDisabledComment() throws IOException { final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT)) { printer.printComment("This is a comment"); assertEquals("", sw.toString()); } }
@Test public void testMultiLineComment() throws IOException { final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentMarker('#'))) { printer.printComment("This is a comment\non multiple lines"); assertEquals("# This is a comment" + recordSeparator + "# on multiple lines" + recordSeparator, sw.toString()); } }
@Test public void testSingleLineComment() throws IOException { final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentMarker('#'))) { printer.printComment("This is a comment"); assertEquals("# This is a comment" + recordSeparator, sw.toString()); } }
/** * Prints a comment. * * @param comment comment to print * @throws IOException if printing failed */ protected void printComment(String comment) throws IOException { this.printer.printComment(comment); }
for (final String line : format.getHeaderComments()) { if (line != null) { this.printComment(line);
public static void toCSV(CSVPrinter aOut, AgreementResult aAgreement) throws IOException aOut.printComment(String.format("Category count: %d%n", aAgreement.getStudy() .getCategoryCount())); aOut.printComment(String.format("Category count: %s%n", ExceptionUtils.getRootCauseMessage(e))); aOut.printComment(String.format("Item count: %d%n", aAgreement.getStudy() .getItemCount())); aOut.printComment(String.format("Item count: %s%n", ExceptionUtils.getRootCauseMessage(e))); aOut.printComment(String.format("Relevant position count: %d%n", aAgreement.getRelevantSetCount()));
headerRow.add( LocaleHelper.getLocalizedMessage( locale, Admin.Field_Session_LastURL, config ) ); headerRow.add( LocaleHelper.getLocalizedMessage( locale, Admin.Field_Session_IntruderAttempts, config ) ); csvPrinter.printComment( StringUtil.join( headerRow, "," ) );
headerRow.add( "Setting" ); headerRow.add( "Profile" ); csvPrinter.printComment( StringUtil.join( headerRow, "," ) );
headerRow.add( "Size" ); headerRow.add( "sha1sum" ); csvPrinter.printComment( StringUtil.join( headerRow, "," ) );
csvPrinter.printComment( " " + PwmConstants.PWM_APP_NAME + " audit record output " ); csvPrinter.printComment( " " + JavaHelper.toIsoDate( Instant.now() ) );
csvPrinter.printComment( PwmConstants.PWM_APP_NAME + " " + PwmConstants.SERVLET_VERSION + " LocalDB export on " + JavaHelper.toIsoDate( new Date() ) ); for ( final LocalDB.DB loopDB : LocalDB.DB.values() ) csvPrinter.printComment( "Export of " + loopDB.toString() ); final LocalDB.LocalDBIterator<String> localDBIterator = localDB.iterator( loopDB ); try csvPrinter.printComment( "export completed at " + JavaHelper.toIsoDate( new Date() ) );
for (String line : format.getHeaderComments()) { if (line != null) { this.printComment(line);
for (final String line : format.getHeaderComments()) { if (line != null) { this.printComment(line);
for (final String line : format.getHeaderComments()) { if (line != null) { this.printComment(line);