|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.shell.io.TextInputFile<E>
E
- the type contained in instances of this interface.public class TextInputFile<E>
This class is used to read input files containing text.
Constructor Summary | |
---|---|
TextInputFile(java.lang.String fileName,
FileFormat fileFormat,
Parser<E> fileLineFormat)
Constructs a new text input file using the provided arguments. |
|
TextInputFile(java.lang.String fileName,
FileFormat fileFormat,
Parser<E> fileLineFormat,
java.util.Collection<java.lang.Character> commentCharacters)
Constructs a new text input file using the provided arguments. |
|
TextInputFile(java.lang.String fileName,
Parser<E> fileLineFormat)
Constructs a new text input file using the provided arguments. |
Method Summary | |
---|---|
void |
close()
Closes this file. |
protected void |
finalize()
Disposes of system resources associated with this file when called by the garbage collector. |
static TextInputFile<java.lang.String> |
getBasic(java.lang.String fileName)
Returns a basic text input file. |
static TextInputFile<java.lang.String> |
getBasic(java.lang.String fileName,
FileFormat fileFormat)
Returns a basic text input file. |
java.lang.String |
getCanonicalName()
Returns the canonical name of this file. |
UnmodifiableCollection<java.lang.Character> |
getCommentChars()
Returns the commment characters used in this file. |
FileFormat |
getFileFormat()
Returns the format of this file. |
Parser<E> |
getLineFormat()
Returns the format used to parse lines of this file. |
java.lang.String |
getOriginalName()
Returns the name of this file. |
boolean |
isClosed()
Indicates if this file has already been closed. |
static boolean |
isValidFormat(FileFormat fileFormat)
Indicates if the provided file format is valid for a text input file. |
java.util.Iterator<E> |
iterator()
Returns a line iterator over this text file. |
java.util.Iterator<E> |
iterator(int line)
Returns a line iterator over this text file beginning at the specified line. |
protected TextFileLineIterator<E> |
lineIterator()
Returns a line iterator over this text file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextInputFile(java.lang.String fileName, Parser<E> fileLineFormat)
fileName
- the name of the file to be read.fileLineFormat
- the format used to parse the lines
of this file.public TextInputFile(java.lang.String fileName, FileFormat fileFormat, Parser<E> fileLineFormat)
fileName
- the name of the file to be read.fileFormat
- the format of the file to be read.fileLineFormat
- the format used to parse the lines
of this file.public TextInputFile(java.lang.String fileName, FileFormat fileFormat, Parser<E> fileLineFormat, java.util.Collection<java.lang.Character> commentCharacters)
fileName
- the name of the file to be read.fileFormat
- the format of the file to be read.fileLineFormat
- the format used to parse the lines
of this file.commentCharacters
- a collection of characters used
for comments in this file.Method Detail |
---|
public static TextInputFile<java.lang.String> getBasic(java.lang.String fileName)
fileName
- the name of the file to be read.
public static TextInputFile<java.lang.String> getBasic(java.lang.String fileName, FileFormat fileFormat)
fileName
- the name of the file to be read.fileFormat
- the file format of this file.
public static boolean isValidFormat(FileFormat fileFormat)
fileFormat
- the file format to test.
true
if the provided file format is
valid for a text input file; false
otherwise.public Parser<E> getLineFormat()
public FileFormat getFileFormat()
public final UnmodifiableCollection<java.lang.Character> getCommentChars()
public final java.lang.String getOriginalName()
getOriginalName
in interface SbrtFile
public final java.lang.String getCanonicalName()
getCanonicalName
in interface SbrtFile
File.getCanonicalPath()
protected final TextFileLineIterator<E> lineIterator()
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
public java.util.Iterator<E> iterator(int line)
0
, and commented or blank lines are
ignored.
line
- the index of the line at which this iterator begins.
java.lang.IndexOutOfBoundsException
- if the provided number exceeds the
number of lines contained in the file.public final void close()
close
in interface SbrtFile
ApplicationException
- if an I/O error occurred
while closing this file.public final boolean isClosed()
isClosed
in interface SbrtFile
true
if this file is closed;
false
othewise.protected final void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- the Exception raised by this method.Object.finalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |