edu.cs.ai.kreator.datamodels
Class DataFile

java.lang.Object
  extended by java.io.File
      extended by edu.cs.ai.kreator.datamodels.AbstractKreatorFile
          extended by edu.cs.ai.kreator.datamodels.DataFile
All Implemented Interfaces:
StainedListener, java.io.Serializable, java.lang.Comparable<java.io.File>
Direct Known Subclasses:
KnowledgebaseFile, KreatorScript, OtherFile, SampleCollection

public abstract class DataFile
extends AbstractKreatorFile

Author:
Sebastian Loh
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.cs.ai.kreator.datamodels.AbstractKreatorFile
fileContent, LOG
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
DataFile(java.io.File file)
           
 
Method Summary
static java.util.List<java.lang.String> getAllSupportedFileExtensions()
          Returns all file extensions, which DataFiles can have.
 void load()
          Reads the content of the file on the file system and overwrites the fileContent attribute with the loaded content.
 void save()
          Saves the fileContent to the file system if the view was changed
 
Methods inherited from class edu.cs.ai.kreator.datamodels.AbstractKreatorFile
addKReatorFileListener, fireModelChanged, getFileContent, removeKReatorFileListener, setFileContent, stainedStatusChanged, viewsAreStained
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataFile

public DataFile(java.io.File file)
         throws java.io.FileNotFoundException,
                java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException
Method Detail

getAllSupportedFileExtensions

public static java.util.List<java.lang.String> getAllSupportedFileExtensions()
Returns all file extensions, which DataFiles can have.

Returns:
all file extensions, which DataFiles can have.

load

public void load()
          throws java.io.FileNotFoundException,
                 java.io.IOException
Reads the content of the file on the file system and overwrites the fileContent attribute with the loaded content.

Specified by:
load in class AbstractKreatorFile
Throws:
java.io.FileNotFoundException - if the specified location does not exist.
java.io.IOException - if the file could not be read from the specified location.

save

public void save()
          throws java.io.IOException
Saves the fileContent to the file system if the view was changed

Specified by:
save in class AbstractKreatorFile
Throws:
java.io.IOException - if the file could not write on the file system.