|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.safs.text.FileLineReader org.safs.staf.service.SAFSFile org.safs.staf.service.SAFSTextFile
public class SAFSTextFile
Copyright 2003 SAS Institute GNU General Public License (GPL) http://www.opensource.org/licenses/gpl-license.php
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
Field Summary | |
---|---|
static int |
MARK_INVALID
|
Fields inherited from class org.safs.staf.service.SAFSFile |
---|
fileid, handle, machine, process |
Fields inherited from class org.safs.text.FileLineReader |
---|
DEFAULT_BUFFER_SIZE, eof, file, filename, firstline, fullpath, linetext, reader, stream |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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(). |
Methods inherited from class org.safs.staf.service.SAFSFile |
---|
getFileID, getHandle, getMachine, getProcess |
Methods inherited from class org.safs.text.FileLineReader |
---|
close, closeReader, getFilename, getFullpath, isClosed, isEOF, open, openFile, openStream, setFile, setStream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MARK_INVALID
Constructor Detail |
---|
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.Method Detail |
---|
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |