com.quadrique.jbuildingblocks.core.io.file.parser
Class JbbFormattedTextFileHandler
java.lang.Object
com.quadrique.jbuildingblocks.core.io.file.parser.JbbFormattedTextFileHandler
- Direct Known Subclasses:
- JbbCsvFormattedTextFileHandler, JbbTabFormattedTextFileHandler
public abstract class JbbFormattedTextFileHandler
- extends Object
This is a base class that provides a framework to parse
and process a formatted text file (e.g. a CSV file) one line at a time.
In order to use it, just creates a derived class that implements the processLine()
method and call processFile() to process a given formatted text file.
- Author:
- Hervé Rivere
JbbFormattedTextFileHandler
public JbbFormattedTextFileHandler()
getFile
public File getFile()
- Returns:
- the file to be processed
setFile
public void setFile(File file)
- Parameters:
file - the file to process
isIgnoreFirstLine
public boolean isIgnoreFirstLine()
- Returns:
- Returns the ignoreFirstLine.
setIgnoreFirstLine
public void setIgnoreFirstLine(boolean ignoreFirstLine)
- Parameters:
ignoreFirstLine - true to ignore the first line of the file (e.g. if the first line
contains some headers)
setColumnNames
public void setColumnNames(ArrayList<String> names)
throws Exception
- Parameters:
names -
- Throws:
Exception
processFile
public void processFile()
throws Exception
- Throws:
Exception
processLine
public abstract void processLine(JbbFormattedTextFileLine line)
throws Exception
- This method must be implemented in any derived class:
The framework reads one line at a time, parses it and call
this method so that you can implement your own logic.
- Parameters:
line -
- Throws:
Exception
Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.