Package hsa
Class TextOutputFile
- java.lang.Object
-
- hsa.TextOutputFile
-
public class TextOutputFile extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanclosedSet if the file has been closed.protected java.io.PrintWriterfStreams used for the fileprotected java.lang.StringfileNameThe file name.protected java.lang.StringlineSeparatorThe line separator in filesprotected booleanuseStandardIOIndicator whether to write to standard output or a file.
-
Constructor Summary
Constructors Constructor Description TextOutputFile()Contructor - TextOutputFile to write to standard output.TextOutputFile(java.io.File file)Contructor - TextOutputFile to write to a File.TextOutputFile(java.io.File file, boolean append)Contructor - TextOutputFile to write or append to a File.TextOutputFile(java.lang.String fileName)Contructor - TextFile to write to file with specified name.TextOutputFile(java.lang.String fileName, boolean append)Contructor - TextFile to write or append to file with specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the file to further writing.booleanisStandardOut()voidprint(boolean value)Write the text representation of a boolean to the file.voidprint(boolean value, int fieldSize)Write the text representation of a boolean to the file with a specified field size.voidprint(byte number)Write the text representation of an 8-bit integer (a "byte") to the file.voidprint(byte number, int fieldSize)Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size.voidprint(char ch)Write a character to the file.voidprint(char ch, int fieldSize)Write a character to the file with a specified field size..voidprint(double number)Write a double precision floating point number (a "double") to the file.voidprint(double number, int fieldSize)Write a double precision floating point number (a "double") to the file with a specified field size.voidprint(double number, int fieldSize, int decimalPlaces)Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places.voidprint(float number)Write a floating point number (a "float") to the file.voidprint(float number, int fieldSize)Write a floating point number (a "float") to the file with a specified field size.voidprint(float number, int fieldSize, int decimalPlaces)Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places.voidprint(int number)Write the text representation of an 32-bit integer (an "int") to the file.voidprint(int number, int fieldSize)Write the text representation of an 32-bit integer (an "int") to the file with a specified field size.voidprint(long number)Write the text representation of an 64-bit integer (a "long") to the file.voidprint(long number, int fieldSize)Write the text representation of an 64-bit integer (a "long") to the file with a specified field size.voidprint(short number)Write the text representation of an 16-bit integer (a "short") to the file.voidprint(short number, int fieldSize)Write the text representation of an 16-bit integer (a "short") to the file with a specified field size.voidprint(java.lang.String text)Write a string to the file.voidprint(java.lang.String text, int fieldSize)Write a string to the file with a specified field size..voidprintln()Write a newline to the file.voidprintln(boolean value)Write the text representation of a boolean to the file followed by a newline.voidprintln(boolean value, int fieldSize)Write the text representation of a boolean to the file with a specified field size followed by a newline.voidprintln(byte number)Write the text representation of an 8-bit integer (a "byte") to the file followed by a newline.voidprintln(byte number, int fieldSize)Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size followed by a newline.voidprintln(char ch)Write a character to the file followed by a newline.voidprintln(char ch, int fieldSize)Write a character to the file with a specified field size..voidprintln(double number)Write a double precision floating point number (a "double") to the file followed by a newline.voidprintln(double number, int fieldSize)Write a double precision floating point number (a "double") to the file with a specified field size followed by a newline.voidprintln(double number, int fieldSize, int decimalPlaces)Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.voidprintln(float number)Write a floating point number (a "float") to the file followed by a newline.voidprintln(float number, int fieldSize)Write a floating point number (a "float") to the file with a specified field size followed by a newline.voidprintln(float number, int fieldSize, int decimalPlaces)Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.voidprintln(int number)Write the text representation of an 32-bit integer (an "int") to the file followed by a newline.voidprintln(int number, int fieldSize)Write the text representation of an 32-bit integer (an "int") to the file with a specified field size followed by a newline.voidprintln(long number)Write the text representation of an 64-bit integer (a "long") to the file followed by a newline.voidprintln(long number, int fieldSize)Write the text representation of an 64-bit integer (a "long") to the file with a specified field size followed by a newline.voidprintln(short number)Write the text representation of an 16-bit integer (a "short") to the file followed by a newline.voidprintln(short number, int fieldSize)Write the text representation of an 16-bit integer (a "short") to the file with a specified field size followed by a newline.voidprintln(java.lang.String text)Write a string to the file followed by a newline.voidprintln(java.lang.String text, int fieldSize)Write a string to the file with a specified field size followed by a newline.
-
-
-
Field Detail
-
fileName
protected java.lang.String fileName
The file name.
-
f
protected java.io.PrintWriter f
Streams used for the file
-
closed
protected boolean closed
Set if the file has been closed.
-
useStandardIO
protected boolean useStandardIO
Indicator whether to write to standard output or a file.
-
lineSeparator
protected java.lang.String lineSeparator
The line separator in files
-
-
Constructor Detail
-
TextOutputFile
public TextOutputFile()
Contructor - TextOutputFile to write to standard output.
-
TextOutputFile
public TextOutputFile(java.io.File file)
Contructor - TextOutputFile to write to a File.- Parameters:
file- - File to be opened.
-
TextOutputFile
public TextOutputFile(java.io.File file, boolean append)Contructor - TextOutputFile to write or append to a File.- Parameters:
file- - File to be opened.append- - True if file is to be appended to.
-
TextOutputFile
public TextOutputFile(java.lang.String fileName)
Contructor - TextFile to write to file with specified name.- Parameters:
fileName- - Name of the file to be opened.
-
TextOutputFile
public TextOutputFile(java.lang.String fileName, boolean append)Contructor - TextFile to write or append to file with specified name.- Parameters:
fileName- - Name of the file to be opened.append- - True if file is to be appended to.
-
-
Method Detail
-
close
public void close()
Close the file to further writing.
-
isStandardOut
public boolean isStandardOut()
-
print
public void print(byte number)
Write the text representation of an 8-bit integer (a "byte") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(byte number, int fieldSize)Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(char ch)
Write a character to the file.- Parameters:
ch- The character to be written to the file.
-
print
public void print(char ch, int fieldSize)Write a character to the file with a specified field size..- Parameters:
ch- The character to be written to the file.fieldSize- The field width that the character is to be written in.
-
print
public void print(double number)
Write a double precision floating point number (a "double") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(double number, int fieldSize)Write a double precision floating point number (a "double") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(double number, int fieldSize, int decimalPlaces)Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.decimalPlaces- The number of decimal places of the number to be displayed.
-
print
public void print(float number)
Write a floating point number (a "float") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(float number, int fieldSize)Write a floating point number (a "float") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(float number, int fieldSize, int decimalPlaces)Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.decimalPlaces- The number of decimal places of the number to be displayed.
-
print
public void print(int number)
Write the text representation of an 32-bit integer (an "int") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(int number, int fieldSize)Write the text representation of an 32-bit integer (an "int") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(long number)
Write the text representation of an 64-bit integer (a "long") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(long number, int fieldSize)Write the text representation of an 64-bit integer (a "long") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(java.lang.String text)
Write a string to the file.- Parameters:
text- The string to be written to the file.
-
print
public void print(java.lang.String text, int fieldSize)Write a string to the file with a specified field size..- Parameters:
text- The string to be written to the file.fieldSize- The field width that the string is to be written in.
-
print
public void print(short number)
Write the text representation of an 16-bit integer (a "short") to the file.- Parameters:
number- The number to be written to the file.
-
print
public void print(short number, int fieldSize)Write the text representation of an 16-bit integer (a "short") to the file with a specified field size.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
print
public void print(boolean value)
Write the text representation of a boolean to the file.- Parameters:
value- The boolean to be written to the file.
-
print
public void print(boolean value, int fieldSize)Write the text representation of a boolean to the file with a specified field size.- Parameters:
value- The boolean to be written to the file.fieldSize- The field width that the boolean is to be written in.
-
println
public void println()
Write a newline to the file.
-
println
public void println(byte number)
Write the text representation of an 8-bit integer (a "byte") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(byte number, int fieldSize)Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(char ch)
Write a character to the file followed by a newline.- Parameters:
ch- The character to be written to the file.
-
println
public void println(char ch, int fieldSize)Write a character to the file with a specified field size..- Parameters:
ch- The character to be written to the file.fieldSize- The field width that the character is to be written in.
-
println
public void println(double number)
Write a double precision floating point number (a "double") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(double number, int fieldSize)Write a double precision floating point number (a "double") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(double number, int fieldSize, int decimalPlaces)Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.decimalPlaces- The number of decimal places of the number to be displayed.
-
println
public void println(float number)
Write a floating point number (a "float") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(float number, int fieldSize)Write a floating point number (a "float") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(float number, int fieldSize, int decimalPlaces)Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.decimalPlaces- The number of decimal places of the number to be displayed.
-
println
public void println(int number)
Write the text representation of an 32-bit integer (an "int") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(int number, int fieldSize)Write the text representation of an 32-bit integer (an "int") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(long number)
Write the text representation of an 64-bit integer (a "long") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(long number, int fieldSize)Write the text representation of an 64-bit integer (a "long") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(java.lang.String text)
Write a string to the file followed by a newline.- Parameters:
text- The string to be written to the file.
-
println
public void println(java.lang.String text, int fieldSize)Write a string to the file with a specified field size followed by a newline.- Parameters:
text- The string to be written to the file.fieldSize- The field width that the string is to be written in.
-
println
public void println(short number)
Write the text representation of an 16-bit integer (a "short") to the file followed by a newline.- Parameters:
number- The number to be written to the file.
-
println
public void println(short number, int fieldSize)Write the text representation of an 16-bit integer (a "short") to the file with a specified field size followed by a newline.- Parameters:
number- The number to be written to the file.fieldSize- The field width that the number is to be written in.
-
println
public void println(boolean value)
Write the text representation of a boolean to the file followed by a newline.- Parameters:
value- The boolean to be written to the file.
-
println
public void println(boolean value, int fieldSize)Write the text representation of a boolean to the file with a specified field size followed by a newline.- Parameters:
value- The boolean to be written to the file.fieldSize- The field width that the boolean is to be written in.
-
-