CH.ifa.draw.util
Interface StorageFormat
-
- All Known Implementing Classes:
- SerializationStorageFormat, StandardStorageFormat
public interface StorageFormatInterface 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
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description javax.swing.filechooser.FileFiltergetFileFilter()Return a FileFilter that can be used to identify files which can be stored and restored with this Storage Format.Drawingrestore(java.lang.String fileName)Restore a Drawing from a file with a given name.java.lang.Stringstore(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.IOExceptionStore a Drawing under a given name.- Parameters:
fileName- file name of the Drawing under which it should be storedsaveDrawing- 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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG