com.reuters.msgtest.load.output.csv
Interface CSVPrint

All Known Implementing Classes:
ExcelCSVPrinter

public interface CSVPrint

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.

Since:
ostermillerutils 1.00.00
Author:
Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities, Pierre Dittgen

Method Summary
 void changeDelimiter(char newDelimiter)
          Change this printer so that it uses a new delimiter.
 void changeQuote(char newQuote)
          Change this printer so that it uses a new character for quoting.
 boolean checkError()
          Flush the stream if it's not closed and check its error state.
 void close()
          Close any underlying streams.
 void flush()
          Flush any data written out to underlying streams.
 void print(java.lang.String value)
          Print the string as the next value on the line.
 void print(java.lang.String[] values)
          Print multiple delimited values values.
 void println()
          Output a blank line.
 void println(java.lang.String value)
          Print the string as the last value on the line.
 void println(java.lang.String[] values)
          Print a single line of comma separated values.
 void println(java.lang.String[][] values)
          Print several lines of comma separated values.
 void printlnComment(java.lang.String comment)
          If the CSV format supports comments, write the comment to the file on its own line, otherwise, start a new line.
 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.
 void setAutoFlush(boolean autoFlush)
          Set flushing behavior.
 void write(java.lang.String value)
          Print the string as the next value on the line.
 void write(java.lang.String[] values)
          Print multiple delimited values values.
 void writeln()
          Output a blank line.
 void writeln(java.lang.String value)
          Print the string as the last value on the line.
 void writeln(java.lang.String[] values)
          Print a single line of comma separated values.
 void writeln(java.lang.String[][] values)
          Print several lines of comma separated values.
 void writelnComment(java.lang.String comment)
          If the CSV format supports comments, write the comment to the file on its own line, otherwise, start a new line.
 

Method Detail

changeDelimiter

public void changeDelimiter(char newDelimiter)
                     throws BadDelimeterException
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.
BadDelimeterException
Since:
ostermillerutils 1.02.18

changeQuote

public void changeQuote(char newQuote)
                 throws BadQuoteException
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.
Since:
ostermillerutils 1.02.18

setAutoFlush

public void setAutoFlush(boolean autoFlush)
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

checkError

public boolean checkError()
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.

Returns:
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

println

public void println(java.lang.String value)
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

writeln

public void writeln(java.lang.String value)
             throws java.io.IOException
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:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

println

public void println()
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

writeln

public void writeln()
             throws java.io.IOException
Output a blank line.

Throws:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

println

public void println(java.lang.String[] values)
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

writeln

public void writeln(java.lang.String[] values)
             throws java.io.IOException
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:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

println

public void println(java.lang.String[][] values)
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

writeln

public void writeln(java.lang.String[][] values)
             throws java.io.IOException
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:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

printlnComment

public void printlnComment(java.lang.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. 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

writelnComment

public void writelnComment(java.lang.String comment)
                    throws java.io.IOException
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:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

print

public void print(java.lang.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. 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

write

public void write(java.lang.String value)
           throws java.io.IOException
Print the string as the next value on the line. The value will be quoted if needed.

Parameters:
value - value to be outputted.
Throws:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

flush

public void flush()
           throws java.io.IOException
Flush any data written out to underlying streams.

Throws:
java.io.IOException
Since:
ostermillerutils 1.02.26

close

public void close()
           throws java.io.IOException
Close any underlying streams.

Throws:
java.io.IOException
Since:
ostermillerutils 1.02.26

print

public void print(java.lang.String[] values)
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

write

public void write(java.lang.String[] values)
           throws java.io.IOException
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:
java.io.IOException - if an error occurs while writing.
Since:
ostermillerutils 1.02.26

setAlwaysQuote

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.

Parameters:
alwaysQuote - true if quotes should be used even when not strictly needed.
Since:
ostermillerutils 1.02.26


Copyright © 2002-2004 The RVTest Team. All Rights Reserved.