Package com.salas.bb.utils.net

Examples of com.salas.bb.utils.net.Downloader


        JFrame frame = Application.getDefaultParentFrame();
        dialog = new DownloadsProgressDialog(frame, locations);

        // Create downloader component
        IStreamProgressListener progressListener = dialog.getProgressListener();
        Downloader downloader = new Downloader(progressListener);

        // Initialize target directory
        File targetDirectory = getTargetDirectory();

        List successful = new ArrayList();
        List failed = new ArrayList();

        // Open progress dialog and start downloading packages
        openProgressDialog(dialog, downloader, locations, targetDirectory);
        try
        {
            for (int i = 0; i < locations.length; i++)
            {
                Location location = locations[i];
                try
                {
                    URL locationURL = new URL(location.getLink());
                    downloader.download(locationURL, targetDirectory);
                    successful.add(location);
                } catch (IOException e)
                {
                    LOG.log(Level.SEVERE, MessageFormat.format(
                        Strings.error("invalid.url"),
View Full Code Here


        /**
         * Invoked when downloading starts.
         */
        public void run()
        {
            Downloader d = new Downloader(null);

            ensureAllDirsPresent(target);
           
            File dir = target.getParentFile();
            final String filename = target.getName();

            try
            {
                d.download(source, dir, filename);
            } catch (InterruptedException e)
            {
                // fall through
            } catch (IOException e)
            {
View Full Code Here

TOP

Related Classes of com.salas.bb.utils.net.Downloader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.