Java Doc for ExcelCSVPrinter.java in  » Template-Engine » ostermillerutils » com » Ostermiller » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » ostermillerutils » com.Ostermiller.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.Ostermiller.util.ExcelCSVPrinter

ExcelCSVPrinter
public class ExcelCSVPrinter implements CSVPrint(Code)
Print values as a comma separated list that can be read by the Excel spreadsheet. More information about this class is available from ostermiller.org.
author:
   Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
author:
   Pierre Dittgen
since:
   ostermillerutils 1.00.00


Field Summary
protected  booleanalwaysQuote
     If auto flushing is enabled.
protected  booleanautoFlush
     If auto flushing is enabled.
protected  chardelimiterChar
     Character written as field delimiter.
protected  booleanerror
     true iff an error has occurred.
protected  StringlineEnding
    
protected  booleannewLine
     True iff we just began a new line.
protected  Writerout
     The place that the values get written.
protected  charquoteChar
     Quoting character.

Constructor Summary
public  ExcelCSVPrinter(OutputStream out)
     Create a printer that will print values to the given stream. Character to byte conversion is done using the default character encoding.
public  ExcelCSVPrinter(Writer out)
     Create a printer that will print values to the given stream. The delimiter will be the comma, the line ending will be the default system line ending, the quote character will be double quotes, quotes will be used when needed, and auto flushing will be enabled.
public  ExcelCSVPrinter(Writer out, boolean alwaysQuote, boolean autoFlush)
     Create a printer that will print values to the given stream. The delimiter will be the comma, the line ending will be the default system line ending, and the quote character will be double quotes.
public  ExcelCSVPrinter(Writer out, char quote, char delimiter)
     Create a printer that will print values to the given stream. The line ending will be the default system line ending, quotes will be used when needed, and auto flushing will be enabled.
public  ExcelCSVPrinter(Writer out, char quote, char delimiter, String lineEnding)
     Create a printer that will print values to the given stream. Quotes will be used when needed, and auto flushing will be enabled.
public  ExcelCSVPrinter(Writer out, char quote, char delimiter, boolean alwaysQuote, boolean autoFlush)
     Create a printer that will print values to the given stream.
public  ExcelCSVPrinter(Writer out, char quote, char delimiter, String lineEnding, boolean alwaysQuote, boolean autoFlush)
     Create a printer that will print values to the given stream.

Method Summary
public  voidchangeDelimiter(char newDelimiter)
     Change this printer so that it uses a new delimiter.
public  voidchangeQuote(char newQuote)
     Change this printer so that it uses a new character for quoting.
public  booleancheckError()
     Flush the stream if it's not closed and check its error state.
public  voidclose()
     Close any underlying streams.
public  voidflush()
     Flush any data written out to underlying streams.
public  voidprint(String[] values)
     Print a single line of comma separated values. The values will be quoted if needed.
public  voidprint(String value)
     Print the string as the next value on the line. The value will be quoted if needed.
public  voidprintln(String value)
     Print the string as the last value on the line. The value will be quoted if needed.

This method never throws an I/O exception.

public  voidprintln()
     Output a blank line.

This method never throws an I/O exception.

public  voidprintln(String[] values)
     Print a single line of comma separated values. The values will be quoted if needed.
public  voidprintln(String[][] values)
     Print several lines of comma separated values. The values will be quoted if needed.
public  voidprintlnComment(String comment)
     Since ExcelCSV format does not support comments, this method will ignore the comment and start a new row.

This method never throws an I/O exception.

public  voidsetAlwaysQuote(boolean alwaysQuote)
     Set whether values printers should always be quoted, or whether the printer may, at its discretion, omit quotes around the value.
public  voidsetAutoFlush(boolean autoFlush)
     Set flushing behavior.
public  voidsetLineEnding(String lineEnding)
     Change this printer so that it uses a new line ending.
public  voidwrite(String[] values)
     Print a single line of comma separated values. The values will be quoted if needed.
public  voidwrite(String value)
     Print the string as the next value on the line. The value will be quoted if needed.
public  voidwriteln(String value)
     Print the string as the last value on the line. The value will be quoted if needed.
public  voidwriteln()
     Output a blank line.
public  voidwriteln(String[] values)
     Print a single line of comma separated values. The values will be quoted if needed.
public  voidwriteln(String[][] values)
     Print several lines of comma separated values. The values will be quoted if needed.
public  voidwritelnComment(String comment)
     Since ExcelCSV format does not support comments, this method will ignore the comment and start a new row.

Field Detail
alwaysQuote
protected boolean alwaysQuote(Code)
If auto flushing is enabled.
since:
   ostermillerutils 1.02.26



autoFlush
protected boolean autoFlush(Code)
If auto flushing is enabled.
since:
   ostermillerutils 1.02.26



delimiterChar
protected char delimiterChar(Code)
Character written as field delimiter.
since:
   ostermillerutils 1.02.18



error
protected boolean error(Code)
true iff an error has occurred.
since:
   ostermillerutils 1.02.26



lineEnding
protected String lineEnding(Code)
The line ending, must be one of "\n", "\r", or "\r\n"
since:
   ostermillerutils 1.06.01



newLine
protected boolean newLine(Code)
True iff we just began a new line.
since:
   ostermillerutils 1.00.00



out
protected Writer out(Code)
The place that the values get written.
since:
   ostermillerutils 1.00.00



quoteChar
protected char quoteChar(Code)
Quoting character.
since:
   ostermillerutils 1.02.18




Constructor Detail
ExcelCSVPrinter
public ExcelCSVPrinter(OutputStream out)(Code)
Create a printer that will print values to the given stream. Character to byte conversion is done using the default character encoding. The delimiter will be the comma, the line ending will be the default system line ending, the quote character will be double quotes, quotes will be used when needed, and auto flushing will be enabled.
Parameters:
  out - stream to which to print.
since:
   ostermillerutils 1.00.00



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out)(Code)
Create a printer that will print values to the given stream. The delimiter will be the comma, the line ending will be the default system line ending, the quote character will be double quotes, quotes will be used when needed, and auto flushing will be enabled.
Parameters:
  out - stream to which to print.
since:
   ostermillerutils 1.00.00



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out, boolean alwaysQuote, boolean autoFlush)(Code)
Create a printer that will print values to the given stream. The delimiter will be the comma, the line ending will be the default system line ending, and the quote character will be double quotes.
Parameters:
  out - stream to which to print.
Parameters:
  alwaysQuote - true if quotes should be used even when not strictly needed.
Parameters:
  autoFlush - should auto flushing be enabled.
since:
   ostermillerutils 1.02.26



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out, char quote, char delimiter) throws BadDelimiterException, BadQuoteException(Code)
Create a printer that will print values to the given stream. The line ending will be the default system line ending, quotes will be used when needed, and auto flushing will be enabled.
Parameters:
  out - stream to which to print.
Parameters:
  delimiter - The new delimiter character to use.
Parameters:
  quote - The new character to use for quoting.
throws:
  BadQuoteException - if the character cannot be used as a quote.
throws:
  BadDelimiterException - if the character cannot be used as a delimiter.
since:
   ostermillerutils 1.02.26



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out, char quote, char delimiter, String lineEnding) throws BadDelimiterException, BadQuoteException, BadLineEndingException(Code)
Create a printer that will print values to the given stream. Quotes will be used when needed, and auto flushing will be enabled.
Parameters:
  out - stream to which to print.
Parameters:
  delimiter - The new delimiter character to use.
Parameters:
  quote - The new character to use for quoting.
Parameters:
  lineEnding - The new line ending, or null to use the default line ending.
throws:
  BadQuoteException - if the character cannot be used as a quote.
throws:
  BadDelimiterException - if the character cannot be used as a delimiter.
throws:
  BadLineEndingException - if the line ending is not one of the three legal line endings.
since:
   ostermillerutils 1.06.01



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out, char quote, char delimiter, boolean alwaysQuote, boolean autoFlush) throws BadDelimiterException, BadQuoteException(Code)
Create a printer that will print values to the given stream. The line ending will be the default system line ending.
Parameters:
  out - stream to which to print.
Parameters:
  delimiter - The new delimiter character to use.
Parameters:
  quote - The new character to use for quoting.
Parameters:
  alwaysQuote - true if quotes should be used even when not strictly needed.
Parameters:
  autoFlush - should auto flushing be enabled.
throws:
  BadQuoteException - if the character cannot be used as a quote.
throws:
  BadDelimiterException - if the character cannot be used as a delimiter.
since:
   ostermillerutils 1.02.26



ExcelCSVPrinter
public ExcelCSVPrinter(Writer out, char quote, char delimiter, String lineEnding, boolean alwaysQuote, boolean autoFlush) throws BadDelimiterException, BadQuoteException, BadLineEndingException(Code)
Create a printer that will print values to the given stream.
Parameters:
  out - stream to which to print.
Parameters:
  delimiter - The new delimiter character to use.
Parameters:
  quote - The new character to use for quoting.
Parameters:
  lineEnding - The new line ending, or null to use the default line ending.
Parameters:
  alwaysQuote - true if quotes should be used even when not strictly needed.
Parameters:
  autoFlush - should auto flushing be enabled.
throws:
  BadQuoteException - if the character cannot be used as a quote.
throws:
  BadDelimiterException - if the character cannot be used as a delimiter.
throws:
  BadLineEndingException - if the line ending is not one of the three legal line endings.
since:
   ostermillerutils 1.06.01




Method Detail
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 error occurs while writing.
since:
   ostermillerutils 1.02.26



flush
public void flush() throws IOException(Code)
Flush any data written out to underlying streams.
throws:
  IOException - if an error occurs while writing.
since:
   ostermillerutils 1.02.26



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




print
public void print(String value)(Code)
Print the string as the next 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 println method.
Parameters:
  value - value to be outputted.
since:
   ostermillerutils 1.00.00




println
public void println(String value)(Code)
Print the string as the last 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 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)
Since ExcelCSV format does not support comments, this method will ignore the comment and start a new row.

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 (ignored).
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



setLineEnding
public void setLineEnding(String lineEnding) throws BadLineEndingException(Code)
Change this printer so that it uses a new line ending.

A line ending must be one of "\n", "\r", or "\r\n".

The default line ending is the system line separator as specified by System.getProperty("line.separator"), or "\n" if the system line separator is not a legal line ending.
Parameters:
  lineEnding - The new line ending, or null to use the default line ending.
throws:
  BadLineEndingException - if the line ending is not one of the three legal line endings.
since:
   ostermillerutils 1.06.01




write
public void write(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



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. 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(String value) throws IOException(Code)
Print the string as the last 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



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)
Since ExcelCSV format does not support comments, this method will ignore the comment and start a new row.
Parameters:
  comment - the comment to output (ignored).
throws:
  IOException - if an error occurs while writing.
since:
   ostermillerutils 1.02.26



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.