Class: PHXRowFieldFile
Last update: 16.07.2025Package:
com.phoenix_int.aserver.util.scriptwrapper.api
Class Hierarchy
↳ java.lang.Object
↳ com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
↳ com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldFile
Implemented Interfaces
- InputFile
- OutputFile
- OutputFile2
- ParseableFile
- java.io.Closeable
- java.lang.AutoCloseable
Declaration
public class PHXRowFieldFile
extends AbstractFile
implements InputFile, OutputFile, OutputFile2
Class implements the parsing capabilities of the RowField type files from the fileWrapper facility. Typical use would be to write a function which creates an instance of this class and implements the parsing using the transferVar() function. Then, a mode can be passed in which specifies whether the function should read the template file, generate an input file, or parse an output file.
You will want to read the documentation on the fileWrapper utility for more specifics on how exactly the file parsing and options work.
Example usage from a java scriptwrapper (Comments show fileWrapper equivalents):
//RowFieldInputFile freqIN
void rowFieldFreqIN(int mode)
throws Exception
{
RowFieldFile file = new RowFieldFile(super.wrapper, mode)
//templateFile: freq.txt.template
file.setTemplateFile("freq.txt.template");
//fileToGenerate: freq.txt
file.setFileToGenerateOrParse("freq.txt");
//variable: W1 double 1 2
file.transferVar(super.W1, 1, 2);
//variable: W2 double 2 2
file.transferVar(super.W2, 2, 2);
//variable: u1 double 3 2
file.transferVar(super.u1, 3, 2);
//variable: u2 double 4 2
file.transferVar(super.u2, 4, 2);
//Actually generate a file if we are told to
if ( mode == RowFieldFile.GENERATE )
file.generate();
}
Nested Class Summary
Nested classes/interfaces inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile
ParseableFile.Mode
Field Summary
| Modifier and Type | Field and Description |
|---|---|
static int |
GENERATEDeprecated in favor of ParseableFile.Mode.GENERATE |
static int |
PARSEDeprecated in favor of ParseableFile.Mode.PARSE |
static int |
READ_TEMPLATEDeprecated in favor of ParseableFile.Mode.READ_TEMPLATE |
Fields inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
encoding, fileName, mode, parser, templateFileName, wrapper
Constructor Summary
| Constructor and Description |
|---|
PHXRowFieldFile(PHXScriptWrapperObject wrapper)Defaults to ParseableFile.Mode.GENERATE |
PHXRowFieldFile(PHXScriptWrapperObject wrapper, int mode)Deprecated in favor of PHXRowFieldFile(PHXScriptWrapperObject, ParseableFile.Mode) |
PHXRowFieldFile(PHXScriptWrapperObject wrapper, ParseableFile.Mode mode) |
PHXRowFieldFile(java.lang.String baseDirectory, int mode)Legacy (pre-QW) constructor. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
void |
clearMarks()Removes effects of any previous markAsBeginning() or markAsEnd() calls |
void |
defineBookmark(java.lang.String name, java.lang.String parent, java.lang.String start) |
void |
defineSection(java.lang.String name, java.lang.String start, java.lang.String end, java.lang.String delimiters) |
void |
defineVar(java.lang.String name, java.lang.String type, boolean isInput, java.lang.String rangeStr) |
void |
defineVar(java.lang.String name, java.lang.String type, boolean isInput, java.lang.String rangeStr, java.lang.String units, java.lang.String description, java.lang.String lowerBound, java.lang.String upperBound, java.lang.String enumValues, java.lang.String enumAliases, java.lang.String format) |
void |
defineVar(java.lang.String name, java.lang.String type, boolean isInput, java.lang.String rangesStr, java.lang.String units, java.lang.String description, java.lang.String lowerBound, java.lang.String upperBound, java.lang.String enumValues, java.lang.String enumAliases, java.lang.String format, java.lang.String fformat) |
protected void |
ensureFileParser(ParseableFile.Mode mode)Ensure there is a valid parser |
void |
generate()Generate the input file |
void |
markAsBeginning(int row)Makes the specified row act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. |
void |
markAsBeginning(java.lang.String find)Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. |
void |
markAsBeginning(java.lang.String find, int occurrence, int offset, boolean regex)Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. |
void |
markAsEnd(int row)Makes the specified row act as row -1 (end of file) for all subsequent calls until another markAsBeginning or clearMarks call. |
void |
markAsEnd(java.lang.String find)Searches for the specified string, starting from the end of the file and working towards the beginning, and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call. |
void |
markAsEnd(java.lang.String find, int occurrence, int offset, boolean regex)Searches for the specified string and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call. |
protected Parser |
newParser(java.io.File rFile, Parser.Mode pmode)Generate a new parser for the given file and mode |
void |
parse()Parse the output file |
double |
readDouble(int row, int field)Reads a value out of the input file. |
long |
readLong(int row, int field)Reads a value out of the input file. |
java.lang.String |
readValue(int row, int field)Reads a value out of the input file. |
void |
setDecimalSeparator(char separator)Set decimal separator for floating point value literals. |
void |
setDelimiters(java.lang.String delimiters)Sets the delimiters which should be used for parsing lines into fields. |
void |
setFileToGenerate(java.lang.String fileName)Set the file to be generated |
void |
setFileToParse(java.lang.String fileName)Set the file to be parsed |
void |
transferArray(PHXSimpleArray var, int rowstart, int rowend, int fieldstart, int fieldend)Transfers the data for a particular array. |
void |
transferArray(PHXSimpleArray var, int rowstart, int rowend, int fieldstart, int fieldend, boolean resizable, java.lang.String fformat)Transfers the data for a particular array. |
void |
transferArray(PHXSimpleArray var, int rowstart, int rowend, int fieldstart, int fieldend, boolean resizable, java.lang.String fformat, int numDimensions)Transfers the data for a particular array. |
void |
transferArray(PHXSimpleArray var, int rowstart, int rowend, int fieldstart, int fieldend, int numDimensions)Transfers the data for a particular array. |
void |
transferKeyVar(PHXSimpleType var, java.lang.String key)Transfers the data for a particular variable. |
void |
transferKeyVar(PHXSimpleType var, java.lang.String key, int occurrence, int rowOffset, int field, java.lang.String fformat)Transfers the data for a particular variable. |
void |
transferVar(PHXSimpleType var, int row, int field)Transfers the data for a particular variable. |
void |
transferVar(PHXSimpleType var, int row, int field, java.lang.String fformat)Transfers the data for a particular variable. |
void |
transferVar(java.lang.String name, PHXSimpleType var, int row, int field) |
void |
transferVar(java.lang.String name, PHXSimpleType var, int row, int field, java.lang.String fformat) |
protected void |
transferVars(ParseableFile.Mode mode)Note that if wrapper is null, variable collection should be empty, and there should be no harm in calling this method |
void |
writeValue(int row, int field, java.lang.String val)Writes a token out to the output file. |
Methods inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
actionByMode, backup, close, delete, getEncoding, getRealFile, readTemplate, setEncoding, setEncoding, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile
backup, close, delete, readTemplate, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable
Field Detail
GENERATE
@Deprecated
public static final int GENERATE
Deprecated in favor of ParseableFile.Mode.GENERATE
This mode makes the row field file prepare to generate the output file by reading the template file, then replacing the specified values passed to transferVar().
PARSE
@Deprecated
public static final int PARSE
Deprecated in favor of ParseableFile.Mode.PARSE
This mode makes the row field file read in values from the fileToParse when transferVar() is called.
READ_TEMPLATE
@Deprecated
public static final int READ_TEMPLATE
Deprecated in favor of ParseableFile.Mode.READ_TEMPLATE
This mode makes the row field file read in values from the template file when transferVar() is called.
Constructor Detail
PHXRowFieldFile
public PHXRowFieldFile(PHXScriptWrapperObject wrapper)
Defaults to ParseableFile.Mode.GENERATE
Parameters:
wrapper- script-wrapper object
PHXRowFieldFile
public PHXRowFieldFile(PHXScriptWrapperObject wrapper,
ParseableFile.Mode mode)
PHXRowFieldFile
@Deprecated
public PHXRowFieldFile(PHXScriptWrapperObject wrapper,
int mode)
Deprecated in favor of PHXRowFieldFile(PHXScriptWrapperObject, ParseableFile.Mode)
Parameters:
wrapper- The row field file will find files relative to the run directory specified in this wrapper object.mode- parser mode
PHXRowFieldFile
public PHXRowFieldFile(java.lang.String baseDirectory,
int mode)
Legacy (pre-QW) constructor.
Note: Using this constructor will make the resultant object incompatible with certain methods. This was necessary for compatibility with QuickWrap. The new constructors accept PHXScriptWrapperObject. This constructor passes null instead.
Parameters:
baseDirectory- All files will be relative to this directorymode- parser mode
Method Detail
generate
public void generate()
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Generate the input file
Specified by:
generatein interfaceInputFile
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
setFileToGenerate
public void setFileToGenerate(java.lang.String fileName)
Set the file to be generated
Specified by:
setFileToGeneratein interfaceInputFile
Parameters:
fileName- file name
parse
public void parse()
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Parse the output file
Specified by:
parsein interfaceOutputFileparsein interfaceOutputFile2
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
setFileToParse
public void setFileToParse(java.lang.String fileName)
Set the file to be parsed
Specified by:
setFileToParsein interfaceOutputFilesetFileToParsein interfaceOutputFile2
Parameters:
fileName- file name
newParser
protected Parser newParser(java.io.File rFile,
Parser.Mode pmode)
throws java.io.IOException
Generate a new parser for the given file and mode
Specified by:
newParserin classAbstractFile
Parameters:
rFile- The file to openpmode- caching mode for underlying parser
Throws:
java.io.IOException
ensureFileParser
protected void ensureFileParser(ParseableFile.Mode mode)
throws java.io.IOException
Ensure there is a valid parser
Overrides:
ensureFileParserin classAbstractFile
Parameters:
mode- parser mode in current context
Throws:
java.io.IOException
defineSection
public void defineSection(java.lang.String name,
java.lang.String start,
java.lang.String end,
java.lang.String delimiters)
throws com.phoenix_int.aserver.util.PHXNoSuchBookmarkException
Throws:
com.phoenix_int.aserver.util.PHXNoSuchBookmarkException
defineBookmark
public void defineBookmark(java.lang.String name,
java.lang.String parent,
java.lang.String start)
defineVar
public void defineVar(java.lang.String name,
java.lang.String type,
boolean isInput,
java.lang.String rangeStr)
throws PHXNameAlreadyInUseException,
PHXInvalidNameException,
PHXInvalidTypeException
Throws:
defineVar
public void defineVar(java.lang.String name,
java.lang.String type,
boolean isInput,
java.lang.String rangeStr,
java.lang.String units,
java.lang.String description,
java.lang.String lowerBound,
java.lang.String upperBound,
java.lang.String enumValues,
java.lang.String enumAliases,
java.lang.String format)
throws PHXNameAlreadyInUseException,
PHXInvalidNameException,
PHXInvalidTypeException
Throws:
defineVar
public void defineVar(java.lang.String name,
java.lang.String type,
boolean isInput,
java.lang.String rangesStr,
java.lang.String units,
java.lang.String description,
java.lang.String lowerBound,
java.lang.String upperBound,
java.lang.String enumValues,
java.lang.String enumAliases,
java.lang.String format,
java.lang.String fformat)
throws PHXNameAlreadyInUseException,
PHXInvalidNameException,
PHXInvalidTypeException
Throws:
transferVars
protected void transferVars(ParseableFile.Mode mode)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Note that if wrapper is null, variable collection should be empty, and there should be no harm in calling this method.
Transfer values for variables that have been defined using methods from the concrete implementation, i.e. defineVar(String, String, boolean, String)
Variables defined using PHXScriptWrapperObject.addVariable(String, String, boolean) must be explicitly transferred using methods of the concrete implementation class.
Specified by:
transferVarsin classAbstractFile
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
transferVar
public void transferVar(PHXSimpleType var,
int row,
int field)
throws java.io.IOException,
PHXNoSuchTokenException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The variable to read or writerow- The row in the file to read/write from/to.field- The field within the row to read/write from/to.
Throws:
java.io.IOExceptionPHXNoSuchTokenExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
transferVar
public void transferVar(java.lang.String name,
PHXSimpleType var,
int row,
int field)
throws java.io.IOException,
PHXNoSuchTokenException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Throws:
java.io.IOExceptionPHXNoSuchTokenExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
transferVar
public void transferVar(PHXSimpleType var,
int row,
int field,
java.lang.String fformat)
throws java.io.IOException,
PHXNoSuchTokenException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The variable to read or writerow- The row in the file to read/write from/to.field- The field within the row to read/write from/to.fformat- The fortran style format string to apply. Pass null for standard formatting.
Throws:
java.io.IOExceptionPHXNoSuchTokenExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
transferVar
public void transferVar(java.lang.String name,
PHXSimpleType var,
int row,
int field,
java.lang.String fformat)
throws java.io.IOException,
PHXNoSuchTokenException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNumberFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Throws:
java.io.IOExceptionPHXNoSuchTokenExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNumberFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
transferArray
public void transferArray(PHXSimpleArray var,
int rowstart,
int rowend,
int fieldstart,
int fieldend)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The array to read or writerowstart- The starting row in the file to read/write from/torowend- The ending row in the file to read/write from/tofieldstart- The starting field within the row to read/write from/tofieldend- The ending field within the row to read/write from/to
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
transferArray
public void transferArray(PHXSimpleArray var,
int rowstart,
int rowend,
int fieldstart,
int fieldend,
int numDimensions)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The array to read or writerowstart- The starting row in the file to read/write from/torowend- The ending row in the file to read/write from/tofieldstart- The starting field within the row to read/write from/tofieldend- The ending field within the row to read/write from/tonumDimensions- Either 1 or 2 to read/write 1 or 2-d arrays.
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
transferArray
public void transferArray(PHXSimpleArray var,
int rowstart,
int rowend,
int fieldstart,
int fieldend,
boolean resizable,
java.lang.String fformat)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The array to read or writerowstart- The starting row in the file to read/write from/torowend- The ending row in the file to read/write from/tofieldstart- The starting field within the row to read/write from/tofieldend- The ending field within the row to read/write from/toresizable- Whether or not the array is resizable when using ParseableFile.Mode.GENERATE.fformat- The fortran style format string to apply. Pass null for standard formatting.
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
transferArray
public void transferArray(PHXSimpleArray var,
int rowstart,
int rowend,
int fieldstart,
int fieldend,
boolean resizable,
java.lang.String fformat,
int numDimensions)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The array to read or writerowstart- The starting row in the file to read/write from/torowend- The ending row in the file to read/write from/tofieldstart- The starting field within the row to read/write from/tofieldend- The ending field within the row to read/write from/toresizable- Whether or not the array is resizable when using ParseableFile.Mode.GENERATE.fformat- The fortran style format string to apply. Pass null for standard formatting.numDimensions- The number of dimensions to read the array as. Must be 1 or 2.
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
transferKeyVar
public void transferKeyVar(PHXSimpleType var,
java.lang.String key)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
PHXNumberFormatException
Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The variable to read or writekey- The string to search for that identifies the variable in the file.
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionPHXNumberFormatException
transferKeyVar
public void transferKeyVar(PHXSimpleType var,
java.lang.String key,
int occurrence,
int rowOffset,
int field,
java.lang.String fformat)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
PHXNumberFormatException
Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.
Parameters:
var- The variable to read or writekey- The string to search for that identifies the variable in the file.occurrence- (default 1). Which occurrence of string to find.rowOffset- (default 0). Once the string is found, offset by this many rowsfield- (default 1). Once the string is found, offset by this many fields. If a negative number is used, it will count from the end of the row backwards, but will not count past the key variable.fformat- The fortran style format string to apply. Pass null for standard formatting.
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionPHXNumberFormatException
readValue
public java.lang.String readValue(int row,
int field)
throws java.io.IOException,
PHXNoSuchTokenException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file.
Parameters:
row- The row of the file to read fromfield- The field of the file to read from.
Throws:
java.lang.IllegalArgumentException- This function does not work ifsetDelimiters("columns")has been specified.java.io.IOExceptionPHXNoSuchTokenExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
readLong
public long readLong(int row,
int field)
throws java.io.IOException,
PHXNoSuchTokenException,
java.lang.NumberFormatException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file. Returns it as a long value.
Parameters:
row- The row of the file to read fromfield- The field of the file to read from.
Throws:
java.lang.IllegalArgumentException- This function does not work ifsetDelimiters("columns")has been specified.java.io.IOExceptionPHXNoSuchTokenExceptionjava.lang.NumberFormatExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
readDouble
public double readDouble(int row,
int field)
throws java.io.IOException,
PHXNoSuchTokenException,
java.lang.NumberFormatException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXBookmarkNotFoundException,
PHXSectionNotFoundException,
com.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file. Returns it as a double value.
Parameters:
row- The row of the file to read fromfield- The field of the file to read from.
Throws:
java.lang.IllegalArgumentException- This function does not work ifsetDelimiters("columns")has been specified.java.io.IOExceptionPHXNoSuchTokenExceptionjava.lang.NumberFormatExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXBookmarkNotFoundExceptionPHXSectionNotFoundExceptioncom.phoenix_int.aserver.util.scriptwrapper.api.PHXRowFieldOutOfFileException
writeValue
public void writeValue(int row,
int field,
java.lang.String val)
throws java.io.IOException,
PHXNoSuchTokenException
Writes a token out to the output file. This is only useful if mode is ParseableFile.Mode.GENERATE.
Parameters:
row- The row of the file to read fromfield- The field of the file to read from.val- The string to write
Throws:
java.lang.IllegalArgumentException- This function does not work ifsetDelimiters("columns")has been specified.java.io.IOExceptionPHXNoSuchTokenException
setDelimiters
public void setDelimiters(java.lang.String delimiters)
throws java.io.IOException
Sets the delimiters which should be used for parsing lines into fields.
Acceptable values:
- "columns" - Fortran style column based fields.
- null - default delimiters (whitespace)
- "whitespace" - default delimiters (whitespace)
- "default" - default delimiters (whitespace)
- "" - default delimiters (whitespace)
- "none" - No delimiters (entire line as single field)
- Any other string is taken as a list of character delimiters
Throws:
java.io.IOException
setDecimalSeparator
public void setDecimalSeparator(char separator)
Set decimal separator for floating point value literals.
Parameters:
separator- character to be used as a decimal separator
clearMarks
public void clearMarks()
throws java.io.IOException
Removes effects of any previous markAsBeginning() or markAsEnd() calls
Throws:
java.io.IOException
markAsBeginning
public void markAsBeginning(java.lang.String find)
throws java.io.IOException,
PHXNoSuchTokenException
Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call.
Throws:
java.io.IOExceptionPHXNoSuchTokenException
markAsBeginning
public void markAsBeginning(java.lang.String find,
int occurrence,
int offset,
boolean regex)
throws java.io.IOException,
PHXNoSuchTokenException
Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call.
Parameters:
find- The string to search for.occurrence- Search for the Nth occurrence of string (default 1)offset- After finding string, move down offset rows. May be negative to move up. (default 0)regex- Iftrue, the find parameter is a regular expression. (defaultfalse)
Throws:
java.io.IOExceptionPHXNoSuchTokenException
markAsBeginning
public void markAsBeginning(int row)
throws java.io.IOException,
PHXNoSuchTokenException
Makes the specified row act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call.
Parameters:
row- The row to set
Throws:
java.io.IOExceptionPHXNoSuchTokenException
markAsEnd
public void markAsEnd(java.lang.String find)
throws java.io.IOException,
PHXNoSuchTokenException
Searches for the specified string, starting from the end of the file and working towards the beginning, and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call.
Parameters:
find- The string to search for.
Throws:
java.io.IOExceptionPHXNoSuchTokenException
markAsEnd
public void markAsEnd(java.lang.String find,
int occurrence,
int offset,
boolean regex)
throws java.io.IOException,
PHXNoSuchTokenException
Searches for the specified string and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call.
Parameters:
find- The string to search for.occurrence- Search for the Nth occurrence of string (default 1)offset- After finding string, move down offset rows. May be negative to move up. (default 0)regex- Iftrue, the find parameter is a regular expression. (defaultfalse)
Throws:
java.io.IOExceptionPHXNoSuchTokenException
markAsEnd
public void markAsEnd(int row)
throws java.io.IOException,
PHXNoSuchTokenException
Makes the specified row act as row -1 (end of file) for all subsequent calls until another markAsBeginning or clearMarks call.
Parameters:
row- The row to set
Throws:
java.io.IOExceptionPHXNoSuchTokenException