Documentation of 'CH.ifa.draw.util.StandardStorageFormat' Java class
StandardStorageFormat
CH.ifa.draw.util

Class StandardStorageFormat

  • All Implemented Interfaces:
    StorageFormat
    Direct Known Subclasses:
    SerializationStorageFormat


    public class StandardStorageFormat
    extends java.lang.Object
    implements StorageFormat
    A StandardStorageFormat is an internal file format to store and restore Drawings. It uses its own descriptive syntax ands write classes and attributes as plain text in a text file. The StandardStorageFormat has the file extension "draw" (e.g. my_picasso.draw).
    • Constructor Summary

      Constructors 
      Constructor and Description
      StandardStorageFormat()
      Create a StandardStorageFormat for storing and restoring Drawings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String createFileDescription()
      Factory method to create a file description for the file type when displaying the associated FileFilter.
      boolean equals(java.lang.Object compareObject)
      Test, whether two StorageFormats are the same.
      java.lang.String getFileDescription()
      Return the file description for the file type of the storage format
      java.lang.String getFileExtension()
      Return the file extension for the storage format
      javax.swing.filechooser.FileFilter getFileFilter()
      Return the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat.
      Drawing restore(java.lang.String fileName)
      Restore a Drawing from a file with a given name.
      void setFileDescription(java.lang.String newFileDescription)
      Set the file description for the file type of the storage format
      void setFileExtension(java.lang.String newFileExtension)
      Set the file extension for the storage format
      void setFileFilter(javax.swing.filechooser.FileFilter newFileFilter)
      Set the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat.
      java.lang.String store(java.lang.String fileName, Drawing saveDrawing)
      Store a Drawing under a given name.
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StandardStorageFormat

        public StandardStorageFormat()
        Create a StandardStorageFormat for storing and restoring Drawings.
    • Method Detail

      • setFileExtension

        public void setFileExtension(java.lang.String newFileExtension)
        Set the file extension for the storage format
        Parameters:
        file - extension
      • getFileExtension

        public java.lang.String getFileExtension()
        Return the file extension for the storage format
        Returns:
        file extension
      • createFileDescription

        public java.lang.String createFileDescription()
        Factory method to create a file description for the file type when displaying the associated FileFilter.
        Returns:
        new file description
      • setFileDescription

        public void setFileDescription(java.lang.String newFileDescription)
        Set the file description for the file type of the storage format
        Parameters:
        newFileDescription - description of the file type
      • getFileDescription

        public java.lang.String getFileDescription()
        Return the file description for the file type of the storage format
        Returns:
        description of the file type
      • setFileFilter

        public void setFileFilter(javax.swing.filechooser.FileFilter newFileFilter)
        Set the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat.
        Parameters:
        newFileFilter - FileFilter for this StorageFormat
      • getFileFilter

        public javax.swing.filechooser.FileFilter getFileFilter()
        Return the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat.
        Specified by:
        getFileFilter in interface StorageFormat
        Returns:
        FileFilter for this StorageFormat
      • store

        public java.lang.String store(java.lang.String fileName,
                                      Drawing saveDrawing)
                               throws java.io.IOException
        Store a Drawing under a given name. If the file name does not have the correct file extension, then the file extension is added.
        Specified by:
        store in interface StorageFormat
        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

        public Drawing restore(java.lang.String fileName)
                        throws java.io.IOException
        Restore a Drawing from a file with a given name.
        Specified by:
        restore in interface StorageFormat
        Parameters:
        name - of the file in which the Drawing has been saved
        Returns:
        restored Drawing
        Throws:
        java.io.IOException
      • equals

        public boolean equals(java.lang.Object compareObject)
        Test, whether two StorageFormats are the same. They are the same if they both support the same file extension.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true, if both StorageFormats have the same file extension, false otherwise

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.