Oracle Application Development Framework Model and Business Components Java API Reference
VERSION

B16005-01


oracle.adf.model.adapter.dataformat.csv
Class CSVParser

java.lang.Object
  extended byoracle.adf.model.adapter.dataformat.csv.CSVParser


public final class CSVParser
extends java.lang.Object

Excel CSV Parser. If no encoding is passed to the constructor, the default encoding used to read the CSV file is "UTF8". Rules of Excel CSV <ui>

      Examples:
        1. ,"abc 123", => abc 123
        2. ,"abc" "123', => abc "123"
        3. ,abc "123", => abc "123" 
    

Field Summary
static java.lang.String UTF8_ENCODING
          UTF8 encoding, used for hadling data in different languages.

 

Constructor Summary
CSVParser(java.io.InputStream pInputStream)
          Constructor
CSVParser(java.io.InputStream pInputStream, java.lang.String pEnc)
          Constructor

 

Method Summary
 java.lang.String[] getLineValues()
          Gets values of next line.
 boolean isEndOfLine()
          Tests if end of line has reached.
 boolean nextLine()
          Moves to the next line of the data.
 void setQuoteChar(char ch)
          Sets the quote character.
 void setSeparators(char[] seps)
          Sets the separator characters as a list of possible separators for the data.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

UTF8_ENCODING

public static final java.lang.String UTF8_ENCODING
UTF8 encoding, used for hadling data in different languages.

Constructor Detail

CSVParser

public CSVParser(java.io.InputStream pInputStream)
          throws java.lang.Exception
Constructor
Parameters:
pInputStream - CSV input stream
Throws:
java.lang.Exception - any error occurred

CSVParser

public CSVParser(java.io.InputStream pInputStream,
                 java.lang.String pEnc)
          throws java.lang.Exception
Constructor
Parameters:
pInputStream - CSV input stream
pEnc - character encoding
Throws:
java.lang.Exception - any error occurred

Method Detail

setSeparators

public void setSeparators(char[] seps)
Sets the separator characters as a list of possible separators for the data. CSV data may have more than one separators. By default this parser considers comma (,) as the data separator.
Parameters:
seps - Array of separator charactors.

setQuoteChar

public void setQuoteChar(char ch)
Sets the quote character.
Parameters:
ch - Quote character.

nextLine

public boolean nextLine()
                 throws java.lang.Exception
Moves to the next line of the data.
Returns:
returns false if the end of data reached.
Throws:
java.lang.Exception - any error occurred

getLineValues

public java.lang.String[] getLineValues()
                                 throws java.lang.Exception
Gets values of next line.
Returns:
next line elements from input stream. If end of data reached, it returns null.
Throws:
java.lang.Exception - any error occurred

isEndOfLine

public boolean isEndOfLine()
Tests if end of line has reached.
Returns:
true if end of line.

Oracle Application Development Framework Model and Business Components Java API Reference
VERSION

B16005-01


Copyright © 1997, 2005, Oracle. All rights reserved.