public class FileOutput
extends java.lang.Object
setFileSystemAccess(desmoj.core.report.FileSystemAccess)
.Modifier and Type | Field and Description |
---|---|
static FileSystemAccess |
NORMAL_FILE_ACCESS
The standard method to write output: Plain files on disk.
|
Constructor and Description |
---|
FileOutput()
Constructs a FileOutput object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Flushes the buffer and closes the file. note that if another file with
the same name is opened and written to, it will overwrite the previous
file on the disc without notice.
|
static java.lang.String |
getEndOfLine()
Returns the currently valid String for separating lines of output.
|
java.lang.String |
getFileName()
Returns the current fileName of this FileOutput or
null if
it has not been opened and named yet. |
static java.lang.String |
getSeparator()
Returns the currently active String for separating individual entries in
a line of output.
|
boolean |
isEmpty()
Returns a boolean value showing if relevant data has been written to the
file.
|
boolean |
isOpen()
Returns the current state of the FileOutput.
|
void |
open(java.lang.String name)
Opens a new file with the given fileName for writing data to.
|
static void |
setEndOfLine(java.lang.String eolString)
Sets the end-of-line separator String to the given parameter value.
|
static void |
setFileSystemAccess(FileSystemAccess fileSystemAccess)
Enables the user to globally change the way files are created/opened.
|
static void |
setSeparator(java.lang.String sepString)
Sets the entry separator String to the given parameter value.
|
void |
write(java.lang.String s)
Writes the given String to the open file.
|
void |
writeln(java.lang.String s)
Writes the given String to the open file, adding a line separator to the
end of the String written.
|
void |
writeSep(java.lang.String s)
Writes the given String to the open file, adding a separator to the end
of the String written.
|
public static final FileSystemAccess NORMAL_FILE_ACCESS
public FileOutput()
open(String fileName)
. Note that if
the output stream used cannot be opened, the whole error handling is
printed to the system's standard output stream. The 'endOfLine' String is
set to the underlying system's String used to separate lines as given by
the system property line.separator
.public void close()
close()
to properly shut down the ouput stream after the
last call to the printing methods. Classes overriding this method should
put all necessary actions to properly close their file into the
close()
method and make a call to
super.close()
as their last command to finally close
buffers and files.public static java.lang.String getEndOfLine()
public java.lang.String getFileName()
null
if
it has not been opened and named yet.null
if
file has not been opened and named yetpublic static java.lang.String getSeparator()
public boolean isEmpty()
true
to indicate that it does not contain information and
thus might just as well be deleted. If data has been written to it, this
method will return false
instead.true
if no relevant data but the
heading has been written to this file, false
otherwisepublic boolean isOpen()
True
is
returned, if the file has been opened successfully and can be written to.
If the file has been closed or has not been opened yet,
false
is returned.true
if the file is currently open,
false
if notpublic void open(java.lang.String name)
name
- java.lang.String : The name of the file to be createdpublic static void setEndOfLine(java.lang.String eolString)
eolString
- String : The String for separating linespublic static void setSeparator(java.lang.String sepString)
sepString
- String : The String for separating entries within a linepublic void write(java.lang.String s)
HTMLFileOutput
class.s
- java.lang.String : The String to write to the fileHTMLFileOutput
public void writeln(java.lang.String s)
void write(String s)
method.s
- java.lang.String : The String to write to the filepublic void writeSep(java.lang.String s)
void write(String s)
method.s
- java.lang.String : The String to write to the filepublic static void setFileSystemAccess(FileSystemAccess fileSystemAccess)