Package jsky.util.gui

Examples of jsky.util.gui.ProgressBarFilterInputStream


                } else {
                    // normal URL
                    urlStr = StringUtil.replace(urlStr, " ", "%20");
                    URL queryUrl = new URL(urlStr);
                    _progressPanel = _getProgressPanel("Downloading query results ...");
                    ProgressBarFilterInputStream in = null;
                    try {
                        URLConnection connection = _progressPanel.openConnection(queryUrl);
                        String contentType = connection.getContentType();
                        if (contentType != null && contentType.equals("text/html")) {
                            // might be an HTML error from the catalog server
View Full Code Here


        _worker = new SwingWorker() {

            public Object construct() {
                setDownloadState(true);
                try {
                    ProgressBarFilterInputStream in = _progressPanel.getLoggedInputStream(url);
                    InputStream stream = SeekableStream.wrapInputStream(in, true);
                    setImage(JAI.create("stream", stream));
                } catch (Exception e) {
                    return e;
                }
View Full Code Here

                setDownloadState(true);
                try {
                    String dir = Preferences.getPreferences().getCacheDir().getPath();
                    File file = File.createTempFile("jsky", ".tmp", new File(dir));
                    //file.deleteOnExit();
                    ProgressBarFilterInputStream in = _progressPanel.getLoggedInputStream(url);
                    FileOutputStream out = new FileOutputStream(file);
                    FileUtil.copy(in, out);
                    in.close();
                    out.close();
                    filename = file.toString();
                } catch (Exception e) {
                    return e;
                }
View Full Code Here

                suffix = ".tmp"// other image formats...
            }

            File file = File.createTempFile("jsky", suffix, new File(dir));
            ProgressPanel progressPanel = getProgressPanel();
            ProgressBarFilterInputStream in = progressPanel.getLoggedInputStream(url);
            FileOutputStream out = new FileOutputStream(file);

            // copy the data
            byte[] buffer = new byte[8 * 1024];
            while (true) {
                int bytesRead = in.read(buffer);
                if (bytesRead == -1) {
                    break;
                }
                if (progressPanel.isInterrupted()) {
                    throw new ProgressException("Interrupted");
                }
                out.write(buffer, 0, bytesRead);
            }

            in.close();
            out.flush();
            out.close();

            if (!progressPanel.isInterrupted()) {
                SwingUtilities.invokeLater(new NavigatorImageLoader(file.toString(), url));
View Full Code Here

        }

        if (_progressPanel == null) {
            _progressPanel = ProgressPanel.makeProgressPanel("Downloading query results ...");
        }
        ProgressBarFilterInputStream in = null;
        try {
            URLConnection connection = _progressPanel.openConnection(queryUrl);
            String contentType = connection.getContentType();
            if (contentType != null && contentType.equals("text/html")) {
                // might be an HTML error from the catalog server
View Full Code Here

TOP

Related Classes of jsky.util.gui.ProgressBarFilterInputStream

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.