All Packages Class Hierarchy This Package Previous Next Index
Class net.strandberg.file.SimpleInFile
java.lang.Object
|
+----net.strandberg.file.SimpleInFile
- public class SimpleInFile
- extends Object
Class for reading input files as textfiles assuming they are
8-bit ASCII (Latin-1) and NOT Unicode
$Revision: 0.1 $
-
inFile_m
-
-
SimpleInFile(File)
- Constructs a new SimpleInFile which will get its contents from the file
pointed to by f.
-
SimpleInFile(String)
- Constructs a new SimpleInFile which will get its contents from the file
pointed to by path.
-
exists()
- Answers whether there exists a file in the filesystem
corresponding to this SimpleInFile.
-
getContents()
- Gets the full contents of this file as a string.
-
getLineNo()
- Get the linenumber in the file where latest line was read.
-
getNextLine()
- Gets next line of this file.
-
putAtFirstLine()
- puts this file at the first line to later be read by getNextLine().
-
toString()
- Returns a string representation of the object.
inFile_m
protected File inFile_m
SimpleInFile
public SimpleInFile(String path)
- Constructs a new SimpleInFile which will get its contents from the file
pointed to by path.
The file is not opened by the constructor.
- Parameters:
- path - the path in the file system to the SimpleInFile
SimpleInFile
public SimpleInFile(File f)
- Constructs a new SimpleInFile which will get its contents from the file
pointed to by f.
The file is not opened by the constructor.
- Parameters:
- f - a file initiated with the path in the file system to
the SimpleInFile
exists
public boolean exists()
- Answers whether there exists a file in the filesystem
corresponding to this SimpleInFile.
- Returns:
- true if the file exists. Otherwise false is returned
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class Object
getLineNo
public int getLineNo()
- Get the linenumber in the file where latest line was read.
- Returns:
- linenumber if reading has been done with getNextLine.
Otherwise returns 0.
getContents
public String getContents() throws FileAccessException
- Gets the full contents of this file as a string.
- Returns:
- All the contents of the file as a string including any
newlines
- Throws: FileAccessException
- If the file does not exist or cannot
be read etc.
putAtFirstLine
public void putAtFirstLine() throws FileAccessException
- puts this file at the first line to later be read by getNextLine().
- Throws: FileAccessException
- If the file does not exist or cannot
be read etc.
getNextLine
public String getNextLine() throws FileAccessException
- Gets next line of this file. When last line was returned in
previous call, null is returned
- Returns:
- next line of input or null if EndOfFile
- Throws: FileAccessException
- If the file does not exist or cannot
be read etc.
All Packages Class Hierarchy This Package Previous Next Index