CH.ifa.draw.util
Class SerializationStorageFormat
- java.lang.Object
-
- CH.ifa.draw.util.StandardStorageFormat
-
- CH.ifa.draw.util.SerializationStorageFormat
-
- All Implemented Interfaces:
- StorageFormat
public class SerializationStorageFormat extends StandardStorageFormat
A SerializationStorageFormat is a straight-forward file format to store and restore Drawings. It uses Java's serialization mechanism to store Drawings. The SerializationStorageFormat has the file extension "ser" (e.g. my_picasso.ser).
-
-
Constructor Summary
Constructors Constructor and Description SerializationStorageFormat()Create a SerialzationStorageFormat for storing and restoring Drawings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringcreateFileDescription()Factory method to create a file description for the file type when displaying the associated FileFilter.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.-
Methods inherited from class CH.ifa.draw.util.StandardStorageFormat
equals, getFileDescription, getFileExtension, getFileFilter, setFileDescription, setFileExtension, setFileFilter
-
-
-
-
Constructor Detail
-
SerializationStorageFormat
public SerializationStorageFormat()
Create a SerialzationStorageFormat for storing and restoring Drawings.
-
-
Method Detail
-
createFileDescription
public java.lang.String createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter.- Overrides:
createFileDescriptionin classStandardStorageFormat- Returns:
- new file description
-
store
public java.lang.String store(java.lang.String fileName, Drawing saveDrawing) throws java.io.IOExceptionStore a Drawing under a given name. The name should be valid with regard to the FileFilter that means, it should already contain the appropriate file extension.- Specified by:
storein interfaceStorageFormat- Overrides:
storein classStandardStorageFormat- 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
public Drawing restore(java.lang.String fileName) throws java.io.IOException
Restore a Drawing from a file with a given name. The name must be should with regard to the FileFilter that means, it should have the appropriate file extension.- Specified by:
restorein interfaceStorageFormat- Overrides:
restorein classStandardStorageFormat- 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