All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.lancs.BasicFileIo

java.lang.Object
   |
   +----java.lancs.BasicFileIo

public class BasicFileIo
extends Object

Variable Index

 o INPUT
Constant - input file
 o OUTPUT
Constant - output file

Constructor Index

 o BasicFileIo()
Constructor for BasicFileIo.
 o BasicFileIo(int, String)
Constructor for BasicFileIo.

Method Index

 o closeFile()
Close the current file
 o openFile(int, String)
Open a file.
 o print(boolean)
 o print(char)
 o print(double)
 o print(float)
 o print(int)
 o print(long)
 o print(String)
 o println()
 o println(boolean)
 o println(char)
 o println(double)
 o println(float)
 o println(int)
 o println(long)
 o println(String)
 o readCharacter()
Read a character from the file, the first on the line
 o readDouble()
read a double value from the file
 o readFloat()
read a float value from the file
 o readInteger()
read the next line from the file as an integer
 o readString()
read the next line from the file as a String
 o writeDouble(double, int, int)
output a double to the file in a field of a specified width
 o writeFloat(float, int, int)
output a float to the file in a field of a specified width
 o writeInteger(int, int)
Write an integer to the file

Variables

 o INPUT
 public static final int INPUT
Constant - input file

 o OUTPUT
 public static final int OUTPUT
Constant - output file

Constructors

 o BasicFileIo
 public BasicFileIo()
Constructor for BasicFileIo. Initialises the filetype to "unknown".

 o BasicFileIo
 public BasicFileIo(int t,
                    String name) throws IOException
Constructor for BasicFileIo.

Parameters:
t - The filetype - either INPUT or OUPUT
name - The filename as a string

Methods

 o openFile
 public void openFile(int t,
                      String name) throws IOException
Open a file. Can be opened for reading or writing

Parameters:
t - The filetype - either INPUT or OUPUT
name - The filename as a string
 o closeFile
 public void closeFile() throws IOException
Close the current file

 o print
 public void print(boolean b)
 o print
 public void print(char c)
 o print
 public void print(double d)
 o print
 public void print(float f)
 o print
 public void print(int i)
 o print
 public void print(long l)
 o print
 public void print(String s)
 o println
 public void println(boolean b)
 o println
 public void println(char c)
 o println
 public void println(double d)
 o println
 public void println(float f)
 o println
 public void println(int i)
 o println
 public void println(long l)
 o println
 public void println(String s)
 o println
 public void println()
 o readString
 public String readString() throws IOException
read the next line from the file as a String

Returns:
the line read from the file as a String
 o readCharacter
 public char readCharacter() throws IOException
Read a character from the file, the first on the line

Returns:
the first character on the next line
 o readInteger
 public int readInteger() throws IOException
read the next line from the file as an integer

Returns:
the line read from the file as an integer
 o readFloat
 public float readFloat() throws IOException
read a float value from the file

Returns:
the float value read from the file
 o readDouble
 public double readDouble() throws IOException
read a double value from the file

Returns:
the double value read from the file
 o writeInteger
 public void writeInteger(int n,
                          int w)
Write an integer to the file

Parameters:
n - The integer to be written
w - The width of the field to write the integer in
 o writeFloat
 public void writeFloat(float n,
                        int w,
                        int d) throws IOException
output a float to the file in a field of a specified width

Parameters:
n - the float to be output to the file
w - the width of the field
d - the number of decimal places
 o writeDouble
 public void writeDouble(double n,
                         int w,
                         int d) throws IOException
output a double to the file in a field of a specified width

Parameters:
n - the double to be output to the file
w - the width of the field
d - the number of decimal places

All Packages  Class Hierarchy  This Package  Previous  Next  Index