Java Doc for CsvReader.java in  » Database-Client » squirrel-sql-2.6.5a » com » csvreader » 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 Client » squirrel sql 2.6.5a » com.csvreader 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.csvreader.CsvReader

CsvReader
public class CsvReader (Code)
A stream based parser for parsing delimited text data from a file or a stream.


Field Summary
final public static  intESCAPE_MODE_BACKSLASH
     Use a backslash character before the text qualifier to represent an occurance of the text qualifier.
final public static  intESCAPE_MODE_DOUBLED
     Double up the text qualifier to represent an occurance of the text qualifier.

Constructor Summary
public  CsvReader(String fileName, char delimiter, Charset charset)
     Creates a com.csvreader.CsvReader CsvReader object using a file as the data source.
public  CsvReader(String fileName, char delimiter)
     Creates a com.csvreader.CsvReader CsvReader object using a file as the data source. Uses ISO-8859-1 as the java.nio.charset.Charset Charset .
public  CsvReader(String fileName)
     Creates a com.csvreader.CsvReader CsvReader object using a file as the data source. Uses a comma as the column delimiter and ISO-8859-1 as the java.nio.charset.Charset Charset .
public  CsvReader(Reader inputStream, char delimiter)
     Constructs a com.csvreader.CsvReader CsvReader object using a java.io.Reader Reader object as the data source.
public  CsvReader(Reader inputStream)
     Constructs a com.csvreader.CsvReader CsvReader object using a java.io.Reader Reader object as the data source. Uses a comma as the column delimiter.
public  CsvReader(InputStream inputStream, char delimiter, Charset charset)
     Constructs a com.csvreader.CsvReader CsvReader object using an java.io.InputStream InputStream object as the data source.
public  CsvReader(InputStream inputStream, Charset charset)
     Constructs a com.csvreader.CsvReader CsvReader object using an java.io.InputStream InputStream object as the data source. Uses a comma as the column delimiter.

Method Summary
public  voidclose()
     Closes and releases all related resources.
protected  voidfinalize()
    
public  Stringget(int columnIndex)
     Returns the current column value for a given column index.
Parameters:
  columnIndex - The index of the column.
public  Stringget(String headerName)
     Returns the current column value for a given column header name.
Parameters:
  headerName - The header name of the column.
public  booleangetCaptureRawRecord()
    
public  intgetColumnCount()
     Gets the count of columns found in this record.
public  chargetComment()
     Gets the character being used as a comment signal.
public  longgetCurrentRecord()
     Gets the index of the current record.
public  chargetDelimiter()
     Gets the character being used as the column delimiter.
public  intgetEscapeMode()
     Gets the current way to escape an occurance of the text qualifier inside qualified data.
public  StringgetHeader(int columnIndex)
     Returns the column header value for a given column index.
Parameters:
  columnIndex - The index of the header column being requested.
public  intgetHeaderCount()
     Gets the count of headers read in by a previous call to com.csvreader.CsvReader.readHeaders readHeaders() .
public  String[]getHeaders()
     Returns the header values as a string array.
public  intgetIndex(String headerName)
     Gets the corresponding column index for a given column header name.
Parameters:
  headerName - The header name of the column.
public  StringgetRawRecord()
    
public  chargetRecordDelimiter()
    
public  booleangetSafetySwitch()
     Safety caution to prevent the parser from using large amounts of memory in the case where parsing settings like file encodings don't end up matching the actual format of a file.
public  booleangetSkipEmptyRecords()
    
public  chargetTextQualifier()
     Gets the character to use as a text qualifier in the data.
public  booleangetTrimWhitespace()
     Gets whether leading and trailing whitespace characters are being trimmed from non-textqualified column data.
public  booleangetUseComments()
     Gets whether comments are being looked for while parsing or not.
public  booleangetUseTextQualifier()
     Whether text qualifiers will be used while parsing or not.
public  String[]getValues()
    
public  booleanisQualified(int columnIndex)
    
public static  CsvReaderparse(String data)
     Creates a com.csvreader.CsvReader CsvReader object using a string of data as the source. Uses ISO-8859-1 as the java.nio.charset.Charset Charset .
Parameters:
  data - The String of data to use as the source.
public  booleanreadHeaders()
     Read the first record of data as column headers.
public  booleanreadRecord()
     Reads another record.
public  voidsetCaptureRawRecord(boolean captureRawRecord)
    
public  voidsetComment(char comment)
     Sets the character to use as a comment signal.
public  voidsetDelimiter(char delimiter)
     Sets the character to use as the column delimiter.
public  voidsetEscapeMode(int escapeMode)
     Sets the current way to escape an occurance of the text qualifier inside qualified data.
public  voidsetHeaders(String[] headers)
    
public  voidsetRecordDelimiter(char recordDelimiter)
     Sets the character to use as the record delimiter.
Parameters:
  recordDelimiter - The character to use as the record delimiter.
public  voidsetSafetySwitch(boolean safetySwitch)
     Safety caution to prevent the parser from using large amounts of memory in the case where parsing settings like file encodings don't end up matching the actual format of a file.
public  voidsetSkipEmptyRecords(boolean skipEmptyRecords)
    
public  voidsetTextQualifier(char textQualifier)
     Sets the character to use as a text qualifier in the data.
public  voidsetTrimWhitespace(boolean trimWhitespace)
     Sets whether leading and trailing whitespace characters should be trimmed from non-textqualified column data or not.
public  voidsetUseComments(boolean useComments)
     Sets whether comments are being looked for while parsing or not.
public  voidsetUseTextQualifier(boolean useTextQualifier)
     Sets whether text qualifiers will be used while parsing or not.
public  booleanskipLine()
     Skips the next line of data using the standard end of line characters and does not do any column delimited parsing.
public  booleanskipRecord()
     Skips the next record of data by parsing each column. Does not increment com.csvreader.CsvReader.getCurrentRecord getCurrentRecord() .

Field Detail
ESCAPE_MODE_BACKSLASH
final public static int ESCAPE_MODE_BACKSLASH(Code)
Use a backslash character before the text qualifier to represent an occurance of the text qualifier.



ESCAPE_MODE_DOUBLED
final public static int ESCAPE_MODE_DOUBLED(Code)
Double up the text qualifier to represent an occurance of the text qualifier.




Constructor Detail
CsvReader
public CsvReader(String fileName, char delimiter, Charset charset) throws FileNotFoundException(Code)
Creates a com.csvreader.CsvReader CsvReader object using a file as the data source.
Parameters:
  fileName - The path to the file to use as the data source.
Parameters:
  delimiter - The character to use as the column delimiter.
Parameters:
  charset - The java.nio.charset.Charset Charset to use whileparsing the data.



CsvReader
public CsvReader(String fileName, char delimiter) throws FileNotFoundException(Code)
Creates a com.csvreader.CsvReader CsvReader object using a file as the data source. Uses ISO-8859-1 as the java.nio.charset.Charset Charset .
Parameters:
  fileName - The path to the file to use as the data source.
Parameters:
  delimiter - The character to use as the column delimiter.



CsvReader
public CsvReader(String fileName) throws FileNotFoundException(Code)
Creates a com.csvreader.CsvReader CsvReader object using a file as the data source. Uses a comma as the column delimiter and ISO-8859-1 as the java.nio.charset.Charset Charset .
Parameters:
  fileName - The path to the file to use as the data source.



CsvReader
public CsvReader(Reader inputStream, char delimiter)(Code)
Constructs a com.csvreader.CsvReader CsvReader object using a java.io.Reader Reader object as the data source.
Parameters:
  inputStream - The stream to use as the data source.
Parameters:
  delimiter - The character to use as the column delimiter.



CsvReader
public CsvReader(Reader inputStream)(Code)
Constructs a com.csvreader.CsvReader CsvReader object using a java.io.Reader Reader object as the data source. Uses a comma as the column delimiter.
Parameters:
  inputStream - The stream to use as the data source.



CsvReader
public CsvReader(InputStream inputStream, char delimiter, Charset charset)(Code)
Constructs a com.csvreader.CsvReader CsvReader object using an java.io.InputStream InputStream object as the data source.
Parameters:
  inputStream - The stream to use as the data source.
Parameters:
  delimiter - The character to use as the column delimiter.
Parameters:
  charset - The java.nio.charset.Charset Charset to use whileparsing the data.



CsvReader
public CsvReader(InputStream inputStream, Charset charset)(Code)
Constructs a com.csvreader.CsvReader CsvReader object using an java.io.InputStream InputStream object as the data source. Uses a comma as the column delimiter.
Parameters:
  inputStream - The stream to use as the data source.
Parameters:
  charset - The java.nio.charset.Charset Charset to use whileparsing the data.




Method Detail
close
public void close()(Code)
Closes and releases all related resources.



finalize
protected void finalize()(Code)



get
public String get(int columnIndex) throws IOException(Code)
Returns the current column value for a given column index.
Parameters:
  columnIndex - The index of the column. The current column value.
exception:
  IOException - Thrown if this object has already been closed.



get
public String get(String headerName) throws IOException(Code)
Returns the current column value for a given column header name.
Parameters:
  headerName - The header name of the column. The current column value.
exception:
  IOException - Thrown if this object has already been closed.



getCaptureRawRecord
public boolean getCaptureRawRecord()(Code)



getColumnCount
public int getColumnCount()(Code)
Gets the count of columns found in this record. The count of columns found in this record.



getComment
public char getComment()(Code)
Gets the character being used as a comment signal. The character being used as a comment signal.



getCurrentRecord
public long getCurrentRecord()(Code)
Gets the index of the current record. The index of the current record.



getDelimiter
public char getDelimiter()(Code)
Gets the character being used as the column delimiter. Default is comma, ','. The character being used as the column delimiter.



getEscapeMode
public int getEscapeMode()(Code)
Gets the current way to escape an occurance of the text qualifier inside qualified data. The current way to escape an occurance of the text qualifierinside qualified data.



getHeader
public String getHeader(int columnIndex) throws IOException(Code)
Returns the column header value for a given column index.
Parameters:
  columnIndex - The index of the header column being requested. The value of the column header at the given column index.
exception:
  IOException - Thrown if this object has already been closed.



getHeaderCount
public int getHeaderCount()(Code)
Gets the count of headers read in by a previous call to com.csvreader.CsvReader.readHeaders readHeaders() . The count of headers read in by a previous call tocom.csvreader.CsvReader.readHeaders readHeaders().



getHeaders
public String[] getHeaders() throws IOException(Code)
Returns the header values as a string array. The header values as a String array.
exception:
  IOException - Thrown if this object has already been closed.



getIndex
public int getIndex(String headerName) throws IOException(Code)
Gets the corresponding column index for a given column header name.
Parameters:
  headerName - The header name of the column. The column index for the given column header name. Returns-1 if not found.
exception:
  IOException - Thrown if this object has already been closed.



getRawRecord
public String getRawRecord()(Code)



getRecordDelimiter
public char getRecordDelimiter()(Code)



getSafetySwitch
public boolean getSafetySwitch()(Code)
Safety caution to prevent the parser from using large amounts of memory in the case where parsing settings like file encodings don't end up matching the actual format of a file. This switch can be turned off if the file format is known and tested. With the switch off, the max column lengths and max column count per record supported by the parser will greatly increase. Default is true. The current setting of the safety switch.



getSkipEmptyRecords
public boolean getSkipEmptyRecords()(Code)



getTextQualifier
public char getTextQualifier()(Code)
Gets the character to use as a text qualifier in the data. The character to use as a text qualifier in the data.



getTrimWhitespace
public boolean getTrimWhitespace()(Code)
Gets whether leading and trailing whitespace characters are being trimmed from non-textqualified column data. Default is true. Whether leading and trailing whitespace characters are beingtrimmed from non-textqualified column data.



getUseComments
public boolean getUseComments()(Code)
Gets whether comments are being looked for while parsing or not. Whether comments are being looked for while parsing or not.



getUseTextQualifier
public boolean getUseTextQualifier()(Code)
Whether text qualifiers will be used while parsing or not. Whether text qualifiers will be used while parsing or not.



getValues
public String[] getValues() throws IOException(Code)



isQualified
public boolean isQualified(int columnIndex) throws IOException(Code)



parse
public static CsvReader parse(String data)(Code)
Creates a com.csvreader.CsvReader CsvReader object using a string of data as the source. Uses ISO-8859-1 as the java.nio.charset.Charset Charset .
Parameters:
  data - The String of data to use as the source. A com.csvreader.CsvReader CsvReader object using theString of data as the source.



readHeaders
public boolean readHeaders() throws IOException(Code)
Read the first record of data as column headers. Whether the header record was successfully read or not.
exception:
  IOException - Thrown if an error occurs while reading data from thesource stream.



readRecord
public boolean readRecord() throws IOException(Code)
Reads another record. Whether another record was successfully read or not.
exception:
  IOException - Thrown if an error occurs while reading data from thesource stream.



setCaptureRawRecord
public void setCaptureRawRecord(boolean captureRawRecord)(Code)



setComment
public void setComment(char comment)(Code)
Sets the character to use as a comment signal.
Parameters:
  comment - The character to use as a comment signal.



setDelimiter
public void setDelimiter(char delimiter)(Code)
Sets the character to use as the column delimiter. Default is comma, ','.
Parameters:
  delimiter - The character to use as the column delimiter.



setEscapeMode
public void setEscapeMode(int escapeMode) throws IllegalArgumentException(Code)
Sets the current way to escape an occurance of the text qualifier inside qualified data.
Parameters:
  escapeMode - The way to escape an occurance of the text qualifier insidequalified data.
exception:
  IllegalArgumentException - When an illegal value is specified for escapeMode.



setHeaders
public void setHeaders(String[] headers)(Code)



setRecordDelimiter
public void setRecordDelimiter(char recordDelimiter)(Code)
Sets the character to use as the record delimiter.
Parameters:
  recordDelimiter - The character to use as the record delimiter. Default iscombination of standard end of line characters for Windows,Unix, or Mac.



setSafetySwitch
public void setSafetySwitch(boolean safetySwitch)(Code)
Safety caution to prevent the parser from using large amounts of memory in the case where parsing settings like file encodings don't end up matching the actual format of a file. This switch can be turned off if the file format is known and tested. With the switch off, the max column lengths and max column count per record supported by the parser will greatly increase. Default is true.
Parameters:
  safetySwitch -



setSkipEmptyRecords
public void setSkipEmptyRecords(boolean skipEmptyRecords)(Code)



setTextQualifier
public void setTextQualifier(char textQualifier)(Code)
Sets the character to use as a text qualifier in the data.
Parameters:
  textQualifier - The character to use as a text qualifier in the data.



setTrimWhitespace
public void setTrimWhitespace(boolean trimWhitespace)(Code)
Sets whether leading and trailing whitespace characters should be trimmed from non-textqualified column data or not. Default is true.
Parameters:
  trimWhitespace - Whether leading and trailing whitespace characters should betrimmed from non-textqualified column data or not.



setUseComments
public void setUseComments(boolean useComments)(Code)
Sets whether comments are being looked for while parsing or not.
Parameters:
  useComments - Whether comments are being looked for while parsing or not.



setUseTextQualifier
public void setUseTextQualifier(boolean useTextQualifier)(Code)
Sets whether text qualifiers will be used while parsing or not.
Parameters:
  useTextQualifier - Whether to use a text qualifier while parsing or not.



skipLine
public boolean skipLine() throws IOException(Code)
Skips the next line of data using the standard end of line characters and does not do any column delimited parsing. Whether a line was successfully skipped or not.
exception:
  IOException - Thrown if an error occurs while reading data from thesource stream.



skipRecord
public boolean skipRecord() throws IOException(Code)
Skips the next record of data by parsing each column. Does not increment com.csvreader.CsvReader.getCurrentRecord getCurrentRecord() . Whether another record was successfully skipped or not.
exception:
  IOException - Thrown if an error occurs while reading data from thesource stream.



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.