net.charlesames.utility.io
Interface FileDocument

All Known Subinterfaces:
TextFileDocument<T>, XmlFileDocument
All Known Implementing Classes:
Ensemble, MidiFile, Score

public interface FileDocument

Interface for entities which persist their content in files.

Author:
Charles Ames

Method Summary
 void dispose()
          Free resources for garbage collection.
 java.io.File getFile()
          Get the file where this document's data persists.
 java.util.Date getLoadDate()
          Get the file load date.
 boolean isDirty()
          Test if the document or any of its components has experienced a change which justifies saving to file.
 void load()
          Load this document from the path indicated using the setFile(File) method.
 void makeDirty()
          Signal that the document has experienced a change which should be saved to the associated file.
 void save()
          Save this document to the path indicated using the setFile(File) method.
 void setFile(java.io.File file)
          Set the file where this document's data will persist.
 

Method Detail

getFile

java.io.File getFile()
Get the file where this document's data persists.

Returns:
The file where this document's data persists.

setFile

void setFile(java.io.File file)
Set the file where this document's data will persist.

Parameters:
file - The file where this document's data will persist.

load

void load()
Load this document from the path indicated using the setFile(File) method.


save

void save()
Save this document to the path indicated using the setFile(File) method. throws RuntimeException If a file already exists with the indicated path and existing file was modified before this instance's load date.


getLoadDate

java.util.Date getLoadDate()
Get the file load date.

Returns:
The file load date.

makeDirty

void makeDirty()
Signal that the document has experienced a change which should be saved to the associated file.


isDirty

boolean isDirty()
Test if the document or any of its components has experienced a change which justifies saving to file.

Returns:
True if a change has occurred; false otherwise.

dispose

void dispose()
Free resources for garbage collection.