Java Doc for Csv.java in  » Database-DBMS » h2database » org » h2 » tools » 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 » Database DBMS » h2database » org.h2.tools 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.h2.tools.Csv

Csv
public class Csv implements SimpleRowSource(Code)
A facility to read from and write to CSV (comma separated values) files.
author:
   Thomas Mueller, Sylvain Cuaz




Method Summary
public  voidclose()
    
public  chargetEscapeCharacter()
     Get the current escape character.
public  chargetFieldDelimiter()
     Get the current field delimiter.
public  chargetFieldSeparatorRead()
     Get the current field separator for reading.
public  StringgetFieldSeparatorWrite()
     Get the current field separator for writing.
public static  CsvgetInstance()
     Get a new object of this class.
public  StringgetRowSeparatorWrite()
     Get the current row separator for writing.
public  ResultSetread(String fileName, String[] colNames, String charset)
     Reads from the CSV file and returns a result set.
public  ResultSetread(Reader reader, String[] colNames)
     Reads CSV data from a reader and returns a result set.
public  Object[]readRow()
    
public  voidreset()
    
public  voidsetEscapeCharacter(char escapeCharacter)
     Set the escape character (used to escape the field delimiter).
public  voidsetFieldDelimiter(char fieldDelimiter)
     Set the field delimiter.
public  voidsetFieldSeparatorRead(char fieldSeparatorRead)
     Override the field separator for reading.
public  voidsetFieldSeparatorWrite(String fieldSeparatorWrite)
     Override the field separator for writing.
public  voidsetLineSeparator(String lineSeparator)
     Set the line separator.
public  voidsetNullString(String nullString)
     Set the value that represents NULL.
public  voidsetRowSeparatorWrite(String rowSeparatorWrite)
     Override the end-of-row marker for writing.
public  intwrite(Writer writer, ResultSet rs)
     Writes the result set to a file in the CSV format.
public  intwrite(String fileName, ResultSet rs, String charset)
     Writes the result set to a file in the CSV format.
public  intwrite(Connection conn, String fileName, String sql, String charset)
     Writes the result set of a query to a file in the CSV format.



Method Detail
close
public void close()(Code)
INTERNAL



getEscapeCharacter
public char getEscapeCharacter()(Code)
Get the current escape character. 0 means no escape character is used. the escape character



getFieldDelimiter
public char getFieldDelimiter()(Code)
Get the current field delimiter. 0 means no field delimiter is used. the field delimiter



getFieldSeparatorRead
public char getFieldSeparatorRead()(Code)
Get the current field separator for reading. the field separator



getFieldSeparatorWrite
public String getFieldSeparatorWrite()(Code)
Get the current field separator for writing. the field separator



getInstance
public static Csv getInstance()(Code)
Get a new object of this class. the new instance



getRowSeparatorWrite
public String getRowSeparatorWrite()(Code)
Get the current row separator for writing. the row separator



read
public ResultSet read(String fileName, String[] colNames, String charset) throws SQLException(Code)
Reads from the CSV file and returns a result set. The rows in the result set are created on demand, that means the file is kept open until all rows are read or the result set is closed.
Parameters:
  fileName - the file name
Parameters:
  colNames - or null if the column names should be read from the CSV file
Parameters:
  charset - the charset or null to use UTF-8 the result set
throws:
  SQLException -



read
public ResultSet read(Reader reader, String[] colNames) throws SQLException, IOException(Code)
Reads CSV data from a reader and returns a result set. The rows in the result set are created on demand, that means the reader is kept open until all rows are read or the result set is closed.
Parameters:
  reader - the reader
Parameters:
  colNames - or null if the column names should be read from the CSV file the result set
throws:
  SQLException - , IOException



readRow
public Object[] readRow() throws SQLException(Code)
INTERNAL



reset
public void reset() throws SQLException(Code)
INTERNAL



setEscapeCharacter
public void setEscapeCharacter(char escapeCharacter)(Code)
Set the escape character (used to escape the field delimiter). The default is " (a double quote). 0 means no escape character is used.
Parameters:
  escapeCharacter - the escape character



setFieldDelimiter
public void setFieldDelimiter(char fieldDelimiter)(Code)
Set the field delimiter. The default is " (a double quote). 0 means no field delimiter is used.
Parameters:
  fieldDelimiter - the field delimiter



setFieldSeparatorRead
public void setFieldSeparatorRead(char fieldSeparatorRead)(Code)
Override the field separator for reading. The default is ','.
Parameters:
  fieldSeparatorRead - the field separator



setFieldSeparatorWrite
public void setFieldSeparatorWrite(String fieldSeparatorWrite)(Code)
Override the field separator for writing. The default is ",".
Parameters:
  fieldSeparatorWrite - the field separator



setLineSeparator
public void setLineSeparator(String lineSeparator)(Code)
Set the line separator.
Parameters:
  lineSeparator - the line separator



setNullString
public void setNullString(String nullString)(Code)
Set the value that represents NULL.
Parameters:
  nullString - the null



setRowSeparatorWrite
public void setRowSeparatorWrite(String rowSeparatorWrite)(Code)
Override the end-of-row marker for writing. The default is null. After writing the end-of-row marker, a line feed is written (\n or \r\n depending on the system settings).
Parameters:
  rowSeparatorWrite - the row separator



write
public int write(Writer writer, ResultSet rs) throws SQLException, IOException(Code)
Writes the result set to a file in the CSV format.
Parameters:
  writer - the writer
Parameters:
  rs - the result set the number of rows written
throws:
  SQLException - ,IOException



write
public int write(String fileName, ResultSet rs, String charset) throws SQLException(Code)
Writes the result set to a file in the CSV format.
Parameters:
  fileName - the name of the csv file
Parameters:
  rs - the result set
Parameters:
  charset - the charset or null to use UTF-8 the number of rows written
throws:
  SQLException -



write
public int write(Connection conn, String fileName, String sql, String charset) throws SQLException(Code)
Writes the result set of a query to a file in the CSV format.
Parameters:
  conn - the connection
Parameters:
  fileName - the file name
Parameters:
  sql - the query
Parameters:
  charset - the charset or null to use UTF-8 the number of rows written
throws:
  SQLException -



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.