|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectJavaGrinders.DataFileParser
public class DataFileParser
interfaces with disk-based files. A file is read and its content is parsed into * individual columns and rows. If no name is provided to its contructor, a getfile * dialog box allows the interactive selection of a file.
| Field Summary | |
|---|---|
java.lang.String[][] |
FileData
|
| Constructor Summary | |
|---|---|
DataFileParser()
constructor for the DataFileParser class if no text file name is provided |
|
DataFileParser(java.lang.String filePath)
standard constructor for the DataFileParser class |
|
| Method Summary | |
|---|---|
int |
getNDataRows()
returns the number of valid data rows that were read from the text file |
int |
getNRows()
provides read access to private variable nRows |
int |
howManyColumns()
provides read access to private variable nCols |
void |
listinFileInfo()
report some info on the content read from the text file |
void |
listinFileInfo(int startLine,
int endLine)
report some info on the content read from the text file |
void |
readToInternalArray()
nitty gritty of reading and parsing, it first steps thrpugh and gets the number * of rows and columns, then opens an array of that size to read into, then fills * it with the content of the file in a second pass |
void |
setDeliminators(java.lang.String delims)
sets the deliminators for the fields in the text file as a regular expression |
void |
setrxcLimted(boolean limited)
set whether the maximum number of rows and columns should be enforced |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String[][] FileData
| Constructor Detail |
|---|
public DataFileParser(java.lang.String filePath)
throws java.lang.Exception
filePath - speficies the name and path of the text file to read from * @param firstLIneAsLabels speficies whether the first row of the text file contains
column labels instead of data
java.lang.Exception
public DataFileParser()
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public void setDeliminators(java.lang.String delims)
delims - specifies the deliminators, e.g. "//s" breaks on all white spacespublic void setrxcLimted(boolean limited)
limited - specifies whether it should be enforcedpublic int howManyColumns()
public int getNRows()
public int getNDataRows()
public void readToInternalArray()
public void listinFileInfo()
public void listinFileInfo(int startLine,
int endLine)
startLine - row at which to startendLine - row at which to end
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||