Class FileHelper

    • Constructor Detail

      • FileHelper

        public FileHelper​(java.awt.Component parent)
    • Method Detail

      • selectOption

        public java.lang.String selectOption​(java.lang.String message,
                                             java.lang.String title,
                                             java.lang.String[] option)
        Specified by:
        selectOption in class CompoundFileHelper
      • getFile

        public static java.io.File getFile​(java.awt.Component parent,
                                           java.lang.String title,
                                           int filetypes)
        For compatibility reasons...
        Parameters:
        parent -
        title -
        filetypes -
        Returns:
      • getCompatibleFileList

        public static java.util.ArrayList<java.io.File> getCompatibleFileList​(java.io.File directory,
                                                                              int filetypes)
      • selectFileToOpen

        public java.io.File selectFileToOpen​(java.lang.String title,
                                             int filetypes,
                                             java.lang.String initialFileName)
        Shows a file-open-dialog, lets the user choose and returns the selected file.
        Parameters:
        title - of the dialog shown
        filetypes - one or more file types defined in CompoundFileHelper
        initialFileName - null or a suggested file name with or without complete path
        Returns:
        null or selected file
      • selectFileToSave

        public java.lang.String selectFileToSave​(java.lang.String title,
                                                 int filetype,
                                                 java.lang.String newFileName)
        Shows a file-save-dialog, lets the user choose and return the file's path and name.
        Specified by:
        selectFileToSave in class CompoundFileHelper
        Parameters:
        title - of the dialog shown
        filetype - one of the file types defined in CompoundFileHelper
        newFileName - null or a suggested file name with or without extension
        Returns:
        null or complete file path and name
      • fileExists

        public static boolean fileExists​(java.io.File file)
        java.io.File.exists() and java.nio.file.Files.exists() may cause minutes of delay, if a file is/was on a network share which is currently unmounted. This version returns quickly.
      • fileExists

        public static boolean fileExists​(java.io.File file,
                                         long timeOutMillis)
        java.io.File.exists() and java.nio.file.Files.exists() may cause minutes of delay, if a file is/was on a network share which is currently unmounted. This version returns quickly.