public class AsciiFileParser
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected java.lang.String |
delims |
The permissible delimeters between fields.
|
protected boolean |
fixed |
Whether the number of fields is fixed.
|
protected char |
inlineComment |
The character used for inline comments.
|
protected int |
nFields |
The number of fixed fields in the file.
|
protected java.util.ArrayList |
rowList |
A list that contains arrays of each set of Strings parsed from each row.
|
protected char |
singleComment |
The character used for single-line comments.
|
Constructor | Description |
---|---|
AsciiFileParser() |
Create an instance.
|
AsciiFileParser(boolean fixed) |
Create an instance.
|
AsciiFileParser(java.io.File file) |
Create an instance and parse a given File.
|
AsciiFileParser(java.io.File file,
boolean fixed) |
Create an instance and parse a given File.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
decode(java.io.File file) |
Open, read and decode the contents of the file.
|
boolean |
getBooleanField(int row,
int column) |
Get the boolean value of a field.
|
java.lang.String |
getDelimeters() |
Get the character used as field delimeters.
|
double |
getDoubleField(int row,
int column) |
Get the double precision value of a field.
|
char |
getInlineCommentChar() |
Get the character used for in-line comments.
|
int |
getIntegerField(int row,
int column) |
Get the integer value of a field.
|
int |
getNFields() |
Get the number of fields located in the file.
|
int |
getNFields(int row) |
Get the number of fields in a row.
|
int |
getNRows() |
Get the number of rows located in the file.
|
java.lang.String[] |
getRow(int row) |
Get the parsed Strings in a row.
|
char |
getSingleCommentChar() |
Get the character used for single line comments.
|
java.lang.String |
getStringField(int row,
int column) |
Get the String value of a field.
|
boolean |
isFixed() |
Get whether the file is expected to have a fixed number of fields.
|
void |
parse(java.io.File file) |
Parse a file using the current configuration.
|
void |
setDelimeters(java.lang.String delims) |
Set the characters used as field delimeters.
|
void |
setFixed(boolean fixed) |
Set whether the file is expected to have a fixed number of fields.
|
void |
setInlineCommentChar(char inlineComment) |
Set the character used for in-line comments.
|
void |
setSingleCommentChar(char singleComment) |
Set the character used for single line comments.
|
protected boolean fixed
protected int nFields
protected java.util.ArrayList rowList
protected char singleComment
protected char inlineComment
protected java.lang.String delims
public AsciiFileParser()
public AsciiFileParser(boolean fixed)
fixed
- whether fixed format is required.public AsciiFileParser(java.io.File file)
file
- reference a File that describes the input file.public AsciiFileParser(java.io.File file, boolean fixed)
file
- reference a File that describes the input file.fixed
- whether fixed format is required.public void setFixed(boolean fixed)
fixed
- whether fixed format is required.public boolean isFixed()
public void parse(java.io.File file)
file
- reference a File that describes the input file.public int getNFields()
public int getNFields(int row)
public int getNRows()
public java.lang.String[] getRow(int row)
public java.lang.String getStringField(int row, int column)
row
- the row index of the field required.column
- the column index of the field required.public int getIntegerField(int row, int column)
row
- the row index of the field required.column
- the column index of the field required.public double getDoubleField(int row, int column)
row
- the row index of the field required.column
- the column index of the field required.public boolean getBooleanField(int row, int column)
row
- the row index of the field required.column
- the column index of the field required.public void setSingleCommentChar(char singleComment)
public char getSingleCommentChar()
public void setInlineCommentChar(char inlineComment)
public char getInlineCommentChar()
public void setDelimeters(java.lang.String delims)
delims
- list of characters to be used as field
delimiters.public java.lang.String getDelimeters()
protected void decode(java.io.File file)
file
- reference a File that describes the input file.Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.