mckay.utilities.general
Class FileSaver
java.lang.Object
mckay.utilities.general.FileSaver
public class FileSaver
- extends java.lang.Object
Objects of this class are used by ResultDisplayPanels (or other classes) to
perform actual saving of data in a variety of formats. This implementation
only allows the saving of html files, but this class can be extended and the
getFileFormatExtension and saveContents methods overridden to allow a greater
variety of file formats.
Method Summary |
java.lang.String[] |
getFileFormatExtension()
Provides an array of the extensions of file formats that may be saved
with this object. |
void |
saveContents(java.lang.String chosen_file_extension,
java.lang.String data_to_save,
java.io.File save_location)
Save the given text to the given location in the given format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileSaver
public FileSaver()
getFileFormatExtension
public java.lang.String[] getFileFormatExtension()
- Provides an array of the extensions of file formats that may be saved
with this object.
- Returns:
- The available file extensions.
saveContents
public void saveContents(java.lang.String chosen_file_extension,
java.lang.String data_to_save,
java.io.File save_location)
throws java.lang.Exception
- Save the given text to the given location in the given format.
- Parameters:
chosen_file_extension
- The file extension (corresponding to one
of the extensions published by the
getFileFormatExtension method) to use when
saving data_to_save, and the corresponding
file format.data_to_save
- The content to save.save_location
- The file to save data_to_save to.
- Throws:
java.lang.Exception
- Throws an Exception if the file cannot be
saved.