| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
  |
  +--bill.util.csv.CSVParser
        |
        +--bill.util.csv.CSVParserSorted
Controls the reading of a CSV file. A CSV file is a comma delimited text data file. This class extends the standard CSV parser and implements sorting of the CSV data. The user must specify the sort columns using the setSortOrder method to enable the sorting functionality.
| Fields inherited from class bill.util.csv.CSVParser | 
| _csvLines, _fileName, _header, _modified, _reader, _skipLines, _writer | 
| Constructor Summary | |
| CSVParserSorted(OutputStream writer)Alternate constructor for skipping lines. | |
| CSVParserSorted(Reader reader)Main constructor. | |
| CSVParserSorted(Reader reader,
                int skipLines)Alternate constructor for skipping lines. | |
| CSVParserSorted(Reader reader,
                OutputStream writer)Alternate constructor. | |
| CSVParserSorted(Reader reader,
                OutputStream writer,
                int skipLines)Alternate constructor for skipping lines. | |
| CSVParserSorted(String fileName)Main constructor. | |
| CSVParserSorted(String fileName,
                int skipLines)Alternate constructor for skipping lines. | |
| Method Summary | |
|  void | addLine(CSVLineParser line)Appends the specified line to the current list of lines. | 
|  void | setLineLinePart(int lineNum,
                int partNum,
                String value)Sets the specified line part from the specified line. | 
|  void | setLineLinePart(int lineNum,
                String partName,
                String value)Sets the specified line part from the specified line. | 
|  void | setReverse(boolean reverse)Sets the reverse sort flag. | 
|  void | setSortOrder(int[] order)Sets the sort order array. | 
|  void | sort()Sorts the list of CSV lines using the previously defined sort order. | 
| Methods inherited from class bill.util.csv.CSVParser | 
| addLine, getFileName, getHeader, getLine, getLineLinePart, getLineLinePart, getLines, getNumberOfLines, getPartNumber, hasHeader, isModified, main, removeLine, save, setFileName, setModified, swapLines | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public CSVParserSorted(String fileName)
                throws CSVException
fileName - The name of the CSV input file.CSVException - If the input file cannot be found, opened, or
 processed.
public CSVParserSorted(Reader reader)
                throws CSVException
save
 method may not be used unless the setFileName method is first
 called. This is because we cannot determine a file name from just the
 stream.reader - The CSV input stream.CSVException - If the input file cannot be found, opened, or
 processed.CSVParser.save(), 
CSVParser.setFileName(String)
public CSVParserSorted(String fileName,
                       int skipLines)
                throws CSVException
fileName - The name of the CSV input file.skipLines - Number of lines to skip before 'really' reading the file.
 This is to get past any lines that may be before the header.CSVException - If the input file cannot be found, opened, or
 processed.
public CSVParserSorted(Reader reader,
                       int skipLines)
                throws CSVException
save method may not be used unless the setFileName
  method is first called. This is because we cannot determine a
 file name from just the stream.reader - The CSV input stream.skipLines - Number of lines to skip before 'really' reading the file.
 This is to get past any lines that may be before the header.CSVException - If the input file cannot be found, opened, or
 processed.CSVParser.save(), 
CSVParser.setFileName(String)
public CSVParserSorted(Reader reader,
                       OutputStream writer)
                throws CSVException
reader - The CSV input stream.writer - The output stream to write to when saving.CSVException - If the input file cannot be found, opened, or
 processed.
public CSVParserSorted(Reader reader,
                       OutputStream writer,
                       int skipLines)
                throws CSVException
reader - The CSV input stream.writer - The output stream to write to when saving.skipLines - Number of lines to skip before 'really' reading the file.
 This is to get past any lines that may be before the header.CSVException - If the input file cannot be found, opened, or
 processed.public CSVParserSorted(OutputStream writer)
writer - The output stream to write to when saving.| Method Detail | 
public void setReverse(boolean reverse)
true this causes all
 the sort order columns to be sorted in reverse order rather than regular
 order.reverse - Value to set the reverse flag to.public void setSortOrder(int[] order)
order - The sort order array.public void sort()
public void setLineLinePart(int lineNum,
                            int partNum,
                            String value)
setLineLinePart in class CSVParserlineNum - The data line to retrieve line part from. Uses a 0 based
 counter, so the first data line is considered line 0.partName - The name of the part to be retrieved, based on the part
 names read from the header line.
public void setLineLinePart(int lineNum,
                            String partName,
                            String value)
                     throws CSVException
setLineLinePart in class CSVParserlineNum - The data line to retrieve line part from. Uses a 0 based
 counter, so the first data line is considered line 0.partName - The name of the part to be retrieved, based on the part
 names read from the header line.CSVException - Thrown when the part name is not valid.public void addLine(CSVLineParser line)
addLine in class CSVParserline - The line parser information to add.| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||