CH.ifa.draw.util
Interface StorageFormat

All Known Implementing Classes:
SerializationStorageFormat, StandardStorageFormat

public interface StorageFormat

Interface to define a storage format. A StorageFormat is a strategy that knows how to store and restore a Drawing according to a specific encoding. Typically it can be recognized by a file extension. To identify a valid file format for a Drawing an appropriate FileFilter for a javax.swing.JFileChooser component can be requested.

See Also:
Drawing, StorageFormatManager

Method Summary
 javax.swing.filechooser.FileFilter getFileFilter()
          Return a FileFilter that can be used to identify files which can be stored and restored with this Storage Format.
 Drawing restore(java.lang.String fileName)
          Restore a Drawing from a file with a given name.
 java.lang.String store(java.lang.String fileName, Drawing saveDrawing)
          Store a Drawing under a given name.
 

Method Detail

getFileFilter

javax.swing.filechooser.FileFilter getFileFilter()
Return a FileFilter that can be used to identify files which can be stored and restored with this Storage Format. Typically, each storage format has its own recognizable file extension.

Returns:
FileFilter to be used with a javax.swing.JFileChooser

store

java.lang.String store(java.lang.String fileName,
                       Drawing saveDrawing)
                       throws java.io.IOException
Store a Drawing under a given name.

Parameters:
fileName - file name of the Drawing under which it should be stored
saveDrawing - drawing to be saved
Returns:
file name with correct file extension
Throws:
java.io.IOException

restore

Drawing restore(java.lang.String fileName)
                throws java.io.IOException
Restore a Drawing from a file with a given name.

Parameters:
name - of the file in which the Drawing has been saved
Returns:
restored Drawing
Throws:
java.io.IOException