public class SAFSTextFile extends SAFSFile
This SAFSTextFile class is intended as the file instance class for services.
Although there are no STAF dependencies, the class is tightly integrated with the
reader. It has not been evaluated for any other use. Though, standalone use
is likely possible.
The class uses a java.io.BufferedReader as the underlying IO mechanism.
SAFSTextFileReader
,
Software Automation Framework Support (SAFS) http://safsdev.sourceforge.net
Software Testing Automation Framework (STAF) http://staf.sourceforge.net
Modifier and Type | Field and Description |
---|---|
static int |
MARK_INVALID |
Constructor and Description |
---|
SAFSTextFile()
This constructor will create an inoperable (Closed) file object.
|
SAFSTextFile(java.lang.String machine,
java.lang.String process,
int handle,
java.lang.String fileid,
java.io.File file,
boolean skipblanklines,
boolean nolinenumbers,
boolean trimleading,
boolean trimtrailing,
boolean trimwhitespace,
java.util.Vector commentids)
The constructor used by the SAFSTextFileReader.
|
Modifier and Type | Method and Description |
---|---|
void |
begin()
resets the current line pointer location back to the beginning of the file.
|
long |
getLineNumber() |
long |
getMark() |
void |
mark()
bookMarks the current line pointer location for a subsequent reset().
|
java.lang.String |
next()
Reads the lines in the file and returns the next line as required by option settings.
|
java.lang.String |
peek()
Returns the last line returned from the 'next' function.
|
java.lang.String |
readLine()
This adds to the SAFSFile.readLine function.
|
void |
reset()
resets the line pointer location to the position of the last bookMark.
|
protected void |
resetpointers()
resets our line and mark pointers to default read-to-get-started values.
|
void |
setMark(long line)
sets a new line pointer location for a subsequent reset().
|
getFileID, getHandle, getMachine, getProcess
close, closeReader, getFilename, getFullpath, isClosed, isEOF, open, openFile, openStream, setFile, setStream
public static final int MARK_INVALID
public SAFSTextFile()
public SAFSTextFile(java.lang.String machine, java.lang.String process, int handle, java.lang.String fileid, java.io.File file, boolean skipblanklines, boolean nolinenumbers, boolean trimleading, boolean trimtrailing, boolean trimwhitespace, java.util.Vector commentids)
super(machine, process, handle, fileid, file, skipblanklines, /
nolinenumbers, trimleading, trimtrailing, trimwhitespace, /
commentids);
This class automatically initializes its SAFSFile superclass with a call to:
super(machine, process, handle, fileid, file);
machine
- The STAF machine that requested this file be opened.process
- The STAF process that requested this file be opened.handle
- The STAF process handle that requested this file be opened.fileid
- A unique String ID to identify this file for the requesting process.
This is not a filename. Multiple open views of the same file can be opened
and each should have a unique fileid within the process namespace.file
- A File object that references the file to be opened.skipblanklines
- true to skip empty lines or lines with only whitespace.
By default we it will not skip blank lines.nolinenumbers
- true to turn off the line numbering prefix. By defaul line numbers
prefix the returned text.trimleading
- trim only leading whitespace from the line.trimtrailing
- trim only trailing whitespace from the line.trimwhitespace
- trim leading AND trailing whitespace from the line.commentids
- essentially a set of strings that identify a line as a comment line.
If any are provided, then lines that begin with any one of the stored comment
identifier strings will be skipped. The test for leading substring occurs AFTER
trimming any whitespace if that is enabled.public long getLineNumber()
public long getMark()
public java.lang.String readLine()
This routine should always call super.readLine() to take advantage of UTF-8 FORMAT marker handling done in the superclass.
readLine
in class FileLineReader
public java.lang.String next()
The returned line will be prefixed with the line number followed by a colon unless 'nolinenumbers' was specified (true) when the object was created.
public java.lang.String peek()
public void mark()
public void setMark(long line) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void reset()
public void begin()
protected void resetpointers()
super.resetpointers();
resetpointers
in class FileLineReader
Copyright © SAS Institute. All Rights Reserved.