/** * Prints a single line of delimiter separated values. The values will be quoted if needed. Quotes and newLine * characters will be escaped. * * @param values * values to output. * @throws IOException * If an I/O error occurs */ public void printRecord(final Object... values) throws IOException { for (final Object value : values) { print(value); } println(); }
/** * Prints the string as the next value on the line. The value will be escaped or encapsulated as needed. * * @param value * value to be output. * @throws IOException * If an I/O error occurs */ public void print(final Object value) throws IOException { // null values are considered empty String strValue; if (value == null) { final String nullString = format.getNullString(); strValue = nullString == null ? Constants.EMPTY : nullString; } else { strValue = value.toString(); } this.print(value, strValue, 0, strValue.length()); }
/** * Prints a single line of delimiter separated values. The values will be quoted if needed. Quotes and newLine * characters will be escaped. * * @param values * values to output. * @throws IOException * If an I/O error occurs */ public void printRecord(final Iterable<?> values) throws IOException { for (final Object value : values) { print(value); } println(); }
/** * Prints all the objects in the given JDBC result set. * * @param resultSet result set * the values to print. * @throws IOException * If an I/O error occurs * @throws SQLException if a database access error occurs */ public void printRecords(final ResultSet resultSet) throws SQLException, IOException { final int columnCount = resultSet.getMetaData().getColumnCount(); while (resultSet.next()) { for (int i = 1; i <= columnCount; i++) { print(resultSet.getString(i)); } println(); } }