Package com.ibm.di.parser
Class CSVParser
- java.lang.Object
-
- com.ibm.di.parser.ParserImpl
-
- com.ibm.di.parser.CSVParser
-
- All Implemented Interfaces:
ParserInterface,VersionInfoInterface
public class CSVParser extends ParserImpl
A class reading and writing Entries in a simple one-line-per-Entry format. CSV is short for comma-separated values, and this format is popular for storing tabular data in text form. The separator does not need to be a comma, it can be any single character.- See Also:
Connector
-
-
Field Summary
-
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetLine()Returns the last line that was read or written.java.lang.StringgetVersion()Version information.voidinitParser()This method is called by the hosting component (e.g.java.util.ArrayList<java.lang.String>nextEntry()The method retrieves the values for the nextEntryjava.lang.ObjectquerySchema(java.lang.Object schema)Discover the schema for the Parser.java.lang.Stringquote(java.lang.String src)Quotes the provided expression.EntryreadEntry()Return the next entry from the current input stream.voidsetHeadersWritten(boolean value)Sets if header should be writtenvoidwriteEntry(Entry entry)Write an Entry to the current output stream.-
Methods inherited from class com.ibm.di.parser.ParserImpl
closeParser, debug, debugMode, flush, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, registerScriptBeans, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser
-
-
-
-
Method Detail
-
initParser
public void initParser()
This method is called by the hosting component (e.g. connector) to initialize the parser.- Specified by:
initParserin interfaceParserInterface- Overrides:
initParserin classParserImpl
-
readEntry
public Entry readEntry() throws java.io.IOException
Return the next entry from the current input stream.- Returns:
- The next entry from the input stream
- Throws:
java.io.IOException- if error during reading next Entry occurs.
-
nextEntry
public java.util.ArrayList<java.lang.String> nextEntry() throws java.io.IOExceptionThe method retrieves the values for the nextEntry- Returns:
- List holding the values for the Entry
- Throws:
java.io.IOException
-
writeEntry
public void writeEntry(Entry entry) throws java.lang.Exception
Write an Entry to the current output stream.- Parameters:
entry- The entry to write- Throws:
java.lang.Exception
-
quote
public java.lang.String quote(java.lang.String src)
Quotes the provided expression.- Parameters:
src- source String- Returns:
- the quoted expression
-
setHeadersWritten
public void setHeadersWritten(boolean value)
Sets if header should be written- Parameters:
value- If false, the headers need to be written. If true, the headers are already written, and should not be written again.
-
getVersion
public java.lang.String getVersion()
Version information.- Returns:
- version information.
-
querySchema
public java.lang.Object querySchema(java.lang.Object schema)
Discover the schema for the Parser. For example, a XML Parser could return a representation of the XML Schema or the DTD referenced in a XML file.- Specified by:
querySchemain interfaceParserInterface- Overrides:
querySchemain classParserImpl- Parameters:
schema- The object on which to discover schema- Returns:
- A Vector of com.ibm.di.entry.Entry objects describing each entity
-
getLine
public java.lang.String getLine()
Returns the last line that was read or written. If nothing has been read or written yet, returns null.- Returns:
- the last line that was read or written
- Since:
- 7.2
-
-