ides.api.plugin.io
Interface IOSubsytem


public interface IOSubsytem

Access to loading/saving and import/export of models.


Field Summary
static java.lang.String MODEL_FILE_EXT
          Extension for model files.
static java.lang.String WORKSPACE_FILE_EXT
          Extension for workspace files.
 
Method Summary
 void export(DESModel model, java.io.File dst, java.lang.String description)
          Export a model to the format given in the description.
 java.io.File getFileOfModel(DESModel model)
          Determine the file, if any, where the given model is saved.
 DESModel importFile(java.io.File src, java.lang.String description)
          Import a model.
 DESModel load(java.io.File file)
          Load a DES model from a file.
 void save(DESModel model, java.io.File file)
          Save a DES model to a file.
 void setFileOfModel(DESModel model, java.io.File file)
          Specify the file where a model is saved.
 

Field Detail

WORKSPACE_FILE_EXT

static final java.lang.String WORKSPACE_FILE_EXT
Extension for workspace files.

See Also:
Constant Field Values

MODEL_FILE_EXT

static final java.lang.String MODEL_FILE_EXT
Extension for model files.

See Also:
Constant Field Values
Method Detail

load

DESModel load(java.io.File file)
              throws java.io.IOException
Load a DES model from a file.

Parameters:
file - the file with the model.
Returns:
the model
Throws:
java.io.IOException - if there is a problem while loading the model
See Also:
FileLoadException

save

void save(DESModel model,
          java.io.File file)
          throws java.io.IOException
Save a DES model to a file.

Note: if the file exists, it will be over-written without any notification.

Parameters:
model - the model
file - the file where the model should be saved
Throws:
java.io.IOException - if there is a problem while saving the model

importFile

DESModel importFile(java.io.File src,
                    java.lang.String description)
                    throws java.io.IOException
Import a model. The format of the file is assumed to be given in the description. In order to access the list of supported formats, call IOPluginManager.getImporters().

Parameters:
src - the file to be imported
description - the description of the file format
Returns:
the imported model
Throws:
java.io.IOException - if there is a problem while importing the model
See Also:
IOPluginManager.getImporters(), ImportExportPlugin.getFileDescription(), FileLoadException

export

void export(DESModel model,
            java.io.File dst,
            java.lang.String description)
            throws java.io.IOException
Export a model to the format given in the description. In order to access the list of supported formats, call IOPluginManager.getExporters().

Parameters:
model - the model to be exported
dst - the file where the exported model should be saved
description - the description of the file format
Throws:
java.io.IOException - if there is a problem while exporting the model
See Also:
IOPluginManager.getExporters(), ImportExportPlugin.getFileDescription()

getFileOfModel

java.io.File getFileOfModel(DESModel model)
Determine the file, if any, where the given model is saved.

Parameters:
model - the model
Returns:
the file where the given model is saved; null if the model has not been saved in a file yet

setFileOfModel

void setFileOfModel(DESModel model,
                    java.io.File file)
Specify the file where a model is saved. The file can be null.

This method simply sets an annotation. This method does not cause the model to be saved. To save a model, use save(DESModel, File).

Parameters:
model - the model
file - the file where the model is saved