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 $


Variable Index

 o inFile_m

Constructor Index

 o SimpleInFile(File)
Constructs a new SimpleInFile which will get its contents from the file pointed to by f.
 o SimpleInFile(String)
Constructs a new SimpleInFile which will get its contents from the file pointed to by path.

Method Index

 o exists()
Answers whether there exists a file in the filesystem corresponding to this SimpleInFile.
 o getContents()
Gets the full contents of this file as a string.
 o getLineNo()
Get the linenumber in the file where latest line was read.
 o getNextLine()
Gets next line of this file.
 o putAtFirstLine()
puts this file at the first line to later be read by getNextLine().
 o toString()
Returns a string representation of the object.

Variables

 o inFile_m
 protected File inFile_m

Constructors

 o 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
 o 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

Methods

 o 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
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
 o 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.
 o 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.
 o 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.
 o 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