|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pushtotest.tool.datasource.Xsv
public abstract class Xsv
This is an implementation of a Datasource that allows you to access Comma Separated Values Files.
| Field Summary | |
|---|---|
protected boolean |
after
|
protected boolean |
before
|
protected int |
colcount
|
protected java.util.List |
columns
|
protected int |
currentrow
|
protected java.lang.String[][] |
db
|
protected boolean |
first
|
protected boolean |
firstRowIsColumns
|
protected boolean |
last
|
protected java.lang.String |
lineTerminator
|
protected int |
rowcount
|
| Constructor Summary | |
|---|---|
Xsv()
Default no-op constructor to allow you to override the default setting for things like line endings and column names. |
|
Xsv(java.io.File file)
Constructs a new 'x'sv Object by passing in a File object that has been instantiated to the file to open. |
|
Xsv(java.lang.String path)
Constructs a new 'x'sv Object by passing in a path to the file to open. |
|
| Method Summary | |
|---|---|
int |
columnCount()
Returns the number of columns in the current row. |
boolean |
getBoolean(int column)
Returns the boolean value of the contents at the position of column. |
boolean |
getBoolean(java.lang.String name)
Returns the boolean value found in the column of the given name. |
double |
getDouble(int column)
Returns the double value of the contents at the position of column. |
double |
getDouble(java.lang.String name)
Returns the double value found in the column of the given name. |
double[][] |
getDoubleData()
Get the raw data as a matrix of double values. |
boolean |
getFirstRowIsColumnNames()
Whether this parser will treat the first row as column names or not. |
float |
getFloat(int column)
Returns the float value of the contents at the position of column. |
float |
getFloat(java.lang.String name)
Returns the float value found in the column of the given name. |
int |
getInt(int column)
Returns the int value of the contents at the position of column. |
int |
getInt(java.lang.String name)
Returns the int value found in the column of the given name. |
int[][] |
getIntData()
Get the raw data as a matrix of int values. |
java.lang.String |
getLineTeminator()
Get the value of the line separator currently being used. |
long |
getLong(int column)
Returns the long value of the contents at the position of column. |
long |
getLong(java.lang.String name)
Returns the long value found in the column of the given name. |
java.lang.String[][] |
getRawData()
Get the raw data of the parsed xSV file. |
java.lang.String |
getString(int column)
Returns the string value of the contents at the position of column. |
java.lang.String |
getString(java.lang.String name)
Returns the string value found in the column of the given name. |
boolean |
isAfterLast()
Tells whether the cursor has moved past the last row or not. |
boolean |
isBeforeFirst()
Tells whether the cursor position is before the first line. |
boolean |
isFirst()
Tells whether the cursor is on the first row or not. |
boolean |
isLast()
Tells whether the cursor is on the last row or not. |
boolean |
next()
Moves the cursor to the next line. |
void |
parse(java.io.File file)
Parse a source file into its components parts. |
void |
parse(java.lang.String path)
Parse a source file into its components parts. |
abstract java.lang.String |
separator()
The string that contains the characters that are used as separators. |
void |
setFirstRowIsColumnNames(boolean isColumns)
Is the first row a column name? |
void |
setLineTerminator(java.lang.String lineTerminator)
Set the value of the line terminator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean before
protected boolean first
protected boolean last
protected boolean after
protected boolean firstRowIsColumns
protected java.lang.String lineTerminator
protected int currentrow
protected int rowcount
protected int colcount
protected java.util.List columns
protected java.lang.String[][] db
| Constructor Detail |
|---|
public Xsv()
To parse a file into the component parts.
public Xsv(java.io.File file)
throws java.io.IOException
file - The file object to open.
java.io.IOException - If there is a problem opening the file and
reading its contents.
public Xsv(java.lang.String path)
throws java.io.IOException
path - The path to the file to open.
java.io.IOException - If there is a problem creating the file from the given path
or opening the file and reading its contents.| Method Detail |
|---|
public void parse(java.io.File file)
throws java.io.IOException
file - The File to parse.
java.io.IOException - If there is an error reading or opening the file.
public void parse(java.lang.String path)
throws java.io.IOException
path - The path to the file.
java.io.IOException - If there is an error reading or opening the file.public abstract java.lang.String separator()
public boolean next()
next in interface Datasourcepublic boolean isBeforeFirst()
isBeforeFirst in interface Datasourcepublic boolean isFirst()
isFirst in interface Datasourcepublic boolean isAfterLast()
isAfterLast in interface Datasourcepublic boolean isLast()
isLast in interface Datasource
public java.lang.String getString(int column)
throws DatasourceException
getString in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public java.lang.String getString(java.lang.String name)
throws DatasourceException
getString in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public long getLong(int column)
throws DatasourceException
getLong in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public long getLong(java.lang.String name)
throws DatasourceException
getLong in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public int getInt(int column)
throws DatasourceException
getInt in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public int getInt(java.lang.String name)
throws DatasourceException
getInt in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public double getDouble(int column)
throws DatasourceException
getDouble in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public double getDouble(java.lang.String name)
throws DatasourceException
getDouble in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public float getFloat(int column)
throws DatasourceException
getFloat in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public float getFloat(java.lang.String name)
throws DatasourceException
getFloat in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public boolean getBoolean(int column)
throws DatasourceException
getBoolean in interface Datasourcecolumn - The position of the column in the row. Value is 0 - (columns-1) inclusive.
DatasourceException - If something goes wrong.
public boolean getBoolean(java.lang.String name)
throws DatasourceException
getBoolean in interface Datasourcename - The name of the column in the row.
DatasourceException - If something goes wrong.
public int columnCount()
throws DatasourceException
columnCount in interface DatasourceDatasourceException - If called on an invalid row.public void setLineTerminator(java.lang.String lineTerminator)
lineTerminator - The string that terminates lines.public java.lang.String getLineTeminator()
public void setFirstRowIsColumnNames(boolean isColumns)
isColumns - True if the first row is column names.public boolean getFirstRowIsColumnNames()
public java.lang.String[][] getRawData()
public double[][] getDoubleData()
public int[][] getIntData()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||