Java Doc for CSVParser.java in  » Groupware » hipergate » com » knowgate » misc » 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 » Groupware » hipergate » com.knowgate.misc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.knowgate.misc.CSVParser

CSVParser
public class CSVParser (Code)

Delimited Text Parser

Parses a delimited text file into a memory array


author:
   Sergio Montoro Ten
version:
   3.0



Constructor Summary
public  CSVParser()
    
public  CSVParser(String sCharSetName)
    

Method Summary
public  StringcharSet()
    
public  voidcharSet(String sCharSetName)
    
public  interrorLine()
    
public  intfind(int iCol, String sVal)
    
public  intfindi(int iCol, String sVal)
    
public  intgetColumnCount()
    
public  intgetColumnPosition(String sColumnName)
    
public  chargetDelimiter()
    
public  StringgetField(int iCol, int iRow)
    

Get value for a field at a given row and column.

Column indexes are zero based.
Row indexes range from 0 to getLineCount()-1.
public  StringgetField(String sCol, int iRow)
    
public  StringgetLine(int iLine)
    

Get line from a parsed file.

Lines are delimited by the Line Feed (LF, CHAR(10), '\n') character
Parameters:
  iLine - Line Number [0..getLineCount()-1] Full Text for Line.
public  intgetLineCount()
    
public  voidparseData(char[] aCharData, String sFileDescriptor)
    

Parse data from a character array

Parsed values are stored at an internal array in this CSVParser.
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted.
public  voidparseFile(File oFile, String sFileDescriptor)
    

Parse a delimited text file

Parsed values are stored at an internal array in this CSVParser.
File is readed using the character set specifid at constructor
Parameters:
  oFile - CSV File
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted.
public  voidparseFile(String sFilePath, String sFileDescriptor)
    

Parse a delimited text file

Parsed values are stored at an internal array in this CSVParser.
Parameters:
  sFilePath - File Path
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted.
public  voidwriteToFile(String sFilePath)
    
public  voidwriteToStream(OutputStream oStrm)
    


Constructor Detail
CSVParser
public CSVParser()(Code)



CSVParser
public CSVParser(String sCharSetName)(Code)
Create CSV Parser and set encoding to be used
Parameters:
  sCharSetName - Name of charset encoding




Method Detail
charSet
public String charSet()(Code)



charSet
public void charSet(String sCharSetName)(Code)



errorLine
public int errorLine()(Code)



find
public int find(int iCol, String sVal) throws UnsupportedEncodingException(Code)

Find first occurence of a value at a given column

Search is case sensitive
Parameters:
  iCol - int Column index [0..getColumnCount()-1]
Parameters:
  sVal - String Value sought int
throws:
  UnsupportedEncodingException -
since:
   3.0



findi
public int findi(int iCol, String sVal) throws UnsupportedEncodingException(Code)

Find first occurence of a value at a given column

Search is case insensitive
Parameters:
  iCol - int Column index [0..getColumnCount()-1]
Parameters:
  sVal - String Value sought int
throws:
  UnsupportedEncodingException -
since:
   3.0



getColumnCount
public int getColumnCount()(Code)
Get column count int
since:
   3.0



getColumnPosition
public int getColumnPosition(String sColumnName)(Code)

Parameters:
  sColumnName - Column Name Zero based index for column position or -1 if column was not found.



getDelimiter
public char getDelimiter()(Code)



getField
public String getField(int iCol, int iRow) throws IllegalStateException, ArrayIndexOutOfBoundsException, StringIndexOutOfBoundsException, UnsupportedEncodingException(Code)

Get value for a field at a given row and column.

Column indexes are zero based.
Row indexes range from 0 to getLineCount()-1.
Parameters:
  iCol - Column Index
Parameters:
  iRow - Row Index Field Value
throws:
  IllegalStateException - If parseFile() method was not called prior togetField()
throws:
  ArrayIndexOutOfBoundsException - If Column or Row Index is out of bounds.
throws:
  StringIndexOutOfBoundsException - If Row is malformed.
throws:
  UnsupportedEncodingException - If charset encoding name is not recognized.



getField
public String getField(String sCol, int iRow) throws IllegalStateException, ArrayIndexOutOfBoundsException, StringIndexOutOfBoundsException, UnsupportedEncodingException(Code)

Get value for a field at a given row and column.


Parameters:
  sCol - Column name
Parameters:
  iRow - Row position [0..getLineCount()-1]
throws:
  IllegalStateException -
throws:
  ArrayIndexOutOfBoundsException -
throws:
  StringIndexOutOfBoundsException -
throws:
  UnsupportedEncodingException - Field value



getLine
public String getLine(int iLine) throws IllegalStateException, UnsupportedEncodingException(Code)

Get line from a parsed file.

Lines are delimited by the Line Feed (LF, CHAR(10), '\n') character
Parameters:
  iLine - Line Number [0..getLineCount()-1] Full Text for Line. If iLine<0 or iLine>=getLineCount() then null
throws:
  IllegalStateException - If parseFile() has not been called prior to getLine()
throws:
  UnsupportedEncodingException -



getLineCount
public int getLineCount()(Code)
Get line count int
since:
   3.0



parseData
public void parseData(char[] aCharData, String sFileDescriptor) throws ArrayIndexOutOfBoundsException, RuntimeException, NullPointerException, IllegalArgumentException(Code)

Parse data from a character array

Parsed values are stored at an internal array in this CSVParser.
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted. Lines are delimiter by '\n' characters
Example 1) tx_mail,tx_name,tx_surname
Example 2) "tx_name","tx_surname","tx_salutation"

throws:
  ArrayIndexOutOfBoundsException - Delimited values for a file is greaterthan columns specified at descriptor.
throws:
  RuntimeException - If delimiter is not one of { ',' ';' '|' '`' or '\t' }
throws:
  NullPointerException - if sFileDescriptor is null
throws:
  IllegalArgumentException - if sFileDescriptor is ""



parseFile
public void parseFile(File oFile, String sFileDescriptor) throws ArrayIndexOutOfBoundsException, IOException, FileNotFoundException, RuntimeException, NullPointerException, IllegalArgumentException, UnsupportedEncodingException(Code)

Parse a delimited text file

Parsed values are stored at an internal array in this CSVParser.
File is readed using the character set specifid at constructor
Parameters:
  oFile - CSV File
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted. Lines are delimiter by '\n' characters
Example 1) tx_mail,tx_name,tx_surname
Example 2) "tx_name","tx_surname","tx_salutation"

throws:
  IOException -
throws:
  FileNotFoundException -
throws:
  ArrayIndexOutOfBoundsException - Delimited values for a file is greaterthan columns specified at descriptor.
throws:
  RuntimeException - If delimiter is not one of { ',' ';' '|' '`' or '\t' }
throws:
  NullPointerException - if oFile or sFileDescriptor are null
throws:
  IllegalArgumentException - if sFileDescriptor is ""
throws:
  UnsupportedEncodingException -
since:
   3.0



parseFile
public void parseFile(String sFilePath, String sFileDescriptor) throws ArrayIndexOutOfBoundsException, IOException, FileNotFoundException, RuntimeException, NullPointerException, IllegalArgumentException, UnsupportedEncodingException(Code)

Parse a delimited text file

Parsed values are stored at an internal array in this CSVParser.
Parameters:
  sFilePath - File Path
Parameters:
  sFileDescriptor - A list of column names separated by ',' ';' '|' '`' or '\t'.Column names may be quoted. Lines are delimiter by '\n' characters
Example 1) tx_mail,tx_name,tx_surname
Example 2) "tx_name","tx_surname","tx_salutation"

throws:
  IOException -
throws:
  FileNotFoundException -
throws:
  ArrayIndexOutOfBoundsException - Delimited values for a file is greaterthan columns specified at descriptor.
throws:
  RuntimeException - If delimiter is not one of { ',' ';' '|' '`' or '\t' }
throws:
  NullPointerException - if oFile or sFileDescriptor are null
throws:
  IllegalArgumentException - if sFileDescriptor is ""
throws:
  UnsupportedEncodingException -



writeToFile
public void writeToFile(String sFilePath) throws IOException, SecurityException(Code)
Write CSVParser matrix to delimited text file
Parameters:
  oStrm - OutputStream
throws:
  IOException -
throws:
  SecurityException -
since:
   3.0



writeToStream
public void writeToStream(OutputStream oStrm) throws IOException(Code)
Write CSVParser matrix to an output stream
Parameters:
  oStrm - OutputStream
throws:
  IOException -
since:
   3.0



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.