| com.Ostermiller.util.CSVPrint
All known Subclasses: com.Ostermiller.util.ExcelCSVPrinter, com.Ostermiller.util.CSVPrinter,
CSVPrint | public interface CSVPrint (Code) | | Print values as a comma separated list.
More information about this class is available from ostermiller.org.
This interface is designed to be set of general methods that all
CSV printers should implement.
author: Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities author: Pierre Dittgen since: ostermillerutils 1.00.00 |
Method Summary | |
public void | changeDelimiter(char newDelimiter) Change this printer so that it uses a new delimiter. | public void | changeQuote(char newQuote) Change this printer so that it uses a new character for quoting. | public boolean | checkError() Flush the stream if it's not closed and check its error state. | public void | close() Close any underlying streams. | public void | flush() Flush any data written out to underlying streams. | public void | print(String value) Print the string as the next value on the line. The value
will be quoted if needed.
This method never throws an I/O exception. | public void | print(String[] values) Print multiple delimited values values.
The values will be quoted if needed. | public void | println(String value) Print the string as the last value on the line. The value
will be quoted if needed. | public void | println() Output a blank line.
This method never throws an I/O exception. | public void | println(String[] values) Print a single line of comma separated values.
The values will be quoted if needed. | public void | println(String[][] values) Print several lines of comma separated values.
The values will be quoted if needed. | public void | printlnComment(String comment) If the CSV format supports comments, write the comment
to the file on its own line, otherwise, start a new line.
This method never throws an I/O exception. | public void | setAlwaysQuote(boolean alwaysQuote) Set whether values printers should always be quoted, or
whether the printer may, at its discretion, omit quotes
around the value. | public void | setAutoFlush(boolean autoFlush) Set flushing behavior. | public void | write(String value) Print the string as the next value on the line. The value
will be quoted if needed. | public void | write(String[] values) Print multiple delimited values values.
The values will be quoted if needed. | public void | writeln(String value) Print the string as the last value on the line. The value
will be quoted if needed. | public void | writeln() Output a blank line. | public void | writeln(String[] values) Print a single line of comma separated values.
The values will be quoted if needed. | public void | writeln(String[][] values) Print several lines of comma separated values.
The values will be quoted if needed. | public void | writelnComment(String comment) If the CSV format supports comments, write the comment
to the file on its own line, otherwise, start a new line. |
changeDelimiter | public void changeDelimiter(char newDelimiter) throws BadDelimiterException(Code) | | Change this printer so that it uses a new delimiter.
Parameters: newDelimiter - The new delimiter character to use. throws: BadDelimiterException - if the character cannot be used as a delimiter. author: Pierre Dittgen since: ostermillerutils 1.02.18 |
changeQuote | public void changeQuote(char newQuote) throws BadQuoteException(Code) | | Change this printer so that it uses a new character for quoting.
Parameters: newQuote - The new character to use for quoting. throws: BadQuoteException - if the character cannot be used as a quote. author: Pierre Dittgen since: ostermillerutils 1.02.18 |
checkError | public boolean checkError()(Code) | | Flush the stream if it's not closed and check its error state.
Errors are cumulative; once the stream encounters an error,
this routine will return true on all successive calls.
True if the print stream has encountered an error,either on the underlying output stream or during a format conversion. since: ostermillerutils 1.02.26 |
close | public void close() throws IOException(Code) | | Close any underlying streams.
throws: IOException - if an IO error occurs since: ostermillerutils 1.02.26 |
flush | public void flush() throws IOException(Code) | | Flush any data written out to underlying streams.
throws: IOException - if an IO error occurs since: ostermillerutils 1.02.26 |
print | public void print(String value)(Code) | | Print the string as the next value on the line. The value
will be quoted if needed.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding println method.
Parameters: value - value to be outputted. since: ostermillerutils 1.00.00 |
print | public void print(String[] values)(Code) | | Print multiple delimited values values.
The values will be quoted if needed. Quotes and
and other characters that need it will be escaped.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding write method.
Parameters: values - values to be outputted. since: ostermillerutils 1.02.26 |
println | public void println(String value)(Code) | | Print the string as the last value on the line. The value
will be quoted if needed. If value is null, an empty value is printed.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding writeln method.
Parameters: value - value to be outputted. since: ostermillerutils 1.00.00 |
println | public void println()(Code) | | Output a blank line.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding writeln method.
since: ostermillerutils 1.00.00 |
println | public void println(String[] values)(Code) | | Print a single line of comma separated values.
The values will be quoted if needed. Quotes and
and other characters that need it will be escaped.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding writeln method.
Parameters: values - values to be outputted. since: ostermillerutils 1.00.00 |
println | public void println(String[][] values)(Code) | | Print several lines of comma separated values.
The values will be quoted if needed. Quotes and
newLine characters will be escaped.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding writeln method.
Parameters: values - values to be outputted. since: ostermillerutils 1.00.00 |
printlnComment | public void printlnComment(String comment)(Code) | | If the CSV format supports comments, write the comment
to the file on its own line, otherwise, start a new line.
This method never throws an I/O exception. The client may inquire as to whether
any errors have occurred by invoking checkError(). If an I/O Exception is
desired, the client should use the corresponding writelnComment method.
Parameters: comment - the comment to output. since: ostermillerutils 1.00.00 |
setAlwaysQuote | public void setAlwaysQuote(boolean alwaysQuote)(Code) | | Set whether values printers should always be quoted, or
whether the printer may, at its discretion, omit quotes
around the value.
Parameters: alwaysQuote - true if quotes should be used even when not strictly needed. since: ostermillerutils 1.02.26 |
setAutoFlush | public void setAutoFlush(boolean autoFlush)(Code) | | Set flushing behavior. Iff set, a flush command
will be issued to any underlying stream after each
print or write command.
Parameters: autoFlush - should auto flushing be enabled. since: ostermillerutils 1.02.26 |
write | public void write(String value) throws IOException(Code) | | Print the string as the next value on the line. The value
will be quoted if needed.
Parameters: value - value to be outputted. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
write | public void write(String[] values) throws IOException(Code) | | Print multiple delimited values values.
The values will be quoted if needed. Quotes and
and other characters that need it will be escaped.
Parameters: values - values to be outputted. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
writeln | public void writeln(String value) throws IOException(Code) | | Print the string as the last value on the line. The value
will be quoted if needed. If value is null, an empty value is printed.
Parameters: value - value to be outputted. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
writeln | public void writeln() throws IOException(Code) | | Output a blank line.
throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
writeln | public void writeln(String[] values) throws IOException(Code) | | Print a single line of comma separated values.
The values will be quoted if needed. Quotes and
and other characters that need it will be escaped.
Parameters: values - values to be outputted. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
writeln | public void writeln(String[][] values) throws IOException(Code) | | Print several lines of comma separated values.
The values will be quoted if needed. Quotes and
newLine characters will be escaped.
Parameters: values - values to be outputted. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
writelnComment | public void writelnComment(String comment) throws IOException(Code) | | If the CSV format supports comments, write the comment
to the file on its own line, otherwise, start a new line.
Parameters: comment - the comment to output. throws: IOException - if an error occurs while writing. since: ostermillerutils 1.02.26 |
|
|