Class DownloadFileTask

    • Constructor Detail

      • DownloadFileTask

        public DownloadFileTask​(java.awt.Component parent,
                                java.lang.String address,
                                java.io.File file,
                                boolean mkdir,
                                boolean unpack)
        Creates the download task
        Parameters:
        parent - the parent component relative to which the PleaseWaitDialog is displayed
        address - the URL to download
        file - The destination file
        mkdir - true if the destination directory must be created, false otherwise
        unpack - true if zip archives must be unpacked recursively, false otherwise
        Throws:
        java.lang.IllegalArgumentException - if parent is null
    • Method Detail

      • finish

        protected void finish()
        Description copied from class: PleaseWaitRunnable
        Finish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.
        Specified by:
        finish in class PleaseWaitRunnable
      • realRun

        protected void realRun()
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Description copied from class: PleaseWaitRunnable
        Called in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.
        Specified by:
        realRun in class PleaseWaitRunnable
        Throws:
        org.xml.sax.SAXException - if a SAX error occurs
        java.io.IOException - if an I/O error occurs
      • isCanceled

        public boolean isCanceled()
        Replies true if the task was canceled by the user
        Returns:
        true if the task was canceled by the user, false otherwise
      • unzipFileRecursively

        public static void unzipFileRecursively​(java.io.File file,
                                                java.lang.String dir)
                                         throws java.io.IOException
        Recursive unzipping function TODO: May be placed somewhere else - Tools.Utils?
        Parameters:
        file - zip file
        dir - output directory
        Throws:
        java.io.IOException - if any I/O error occurs