All Packages Class Hierarchy This Package Previous Next Index
Class java.lancs.BasicFileIo
java.lang.Object
|
+----java.lancs.BasicFileIo
- public class BasicFileIo
- extends Object
-
INPUT
- Constant - input file
-
OUTPUT
- Constant - output file
-
BasicFileIo()
- Constructor for BasicFileIo.
-
BasicFileIo(int, String)
- Constructor for BasicFileIo.
-
closeFile()
- Close the current file
-
openFile(int, String)
- Open a file.
-
print(boolean)
-
-
print(char)
-
-
print(double)
-
-
print(float)
-
-
print(int)
-
-
print(long)
-
-
print(String)
-
-
println()
-
-
println(boolean)
-
-
println(char)
-
-
println(double)
-
-
println(float)
-
-
println(int)
-
-
println(long)
-
-
println(String)
-
-
readCharacter()
- Read a character from the file, the first on the line
-
readDouble()
- read a double value from the file
-
readFloat()
- read a float value from the file
-
readInteger()
- read the next line from the file as an integer
-
readString()
- read the next line from the file as a String
-
writeDouble(double, int, int)
- output a double to the file in a field of a specified width
-
writeFloat(float, int, int)
- output a float to the file in a field of a specified width
-
writeInteger(int, int)
- Write an integer to the file
INPUT
public static final int INPUT
- Constant - input file
OUTPUT
public static final int OUTPUT
- Constant - output file
BasicFileIo
public BasicFileIo()
- Constructor for BasicFileIo.
Initialises the filetype to "unknown".
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
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
closeFile
public void closeFile() throws IOException
- Close the current file
print
public void print(boolean b)
print
public void print(char c)
print
public void print(double d)
print
public void print(float f)
print
public void print(int i)
print
public void print(long l)
print
public void print(String s)
println
public void println(boolean b)
println
public void println(char c)
println
public void println(double d)
println
public void println(float f)
println
public void println(int i)
println
public void println(long l)
println
public void println(String s)
println
public void println()
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
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
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
readFloat
public float readFloat() throws IOException
- read a float value from the file
- Returns:
- the float value read from the file
readDouble
public double readDouble() throws IOException
- read a double value from the file
- Returns:
- the double value read from the file
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
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
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