Examples of DownloadStatusChanged


Examples of net.sf.gimme.event.DownloadStatusChanged

        Thread thread = new Thread(this);
        thread.setDaemon(true);
        thread.start();

        status = "Downloading...";
        Mediator.post(new DownloadStatusChanged(this));

        Logger.post(Logger.Level.INFO, "Starting download: " + getName());
    }
View Full Code Here

Examples of net.sf.gimme.event.DownloadStatusChanged

    }

    private void finish()
    {
        status = "Finishing...";
        Mediator.post(new DownloadStatusChanged(this));

        finished = true;

        if(dest.exists())
        {
            Logger.post(Logger.Level.WARNING, "File already exists: " + getName());
        }
        else
        {
            try
            {
                FileOutputStream out = new FileOutputStream(dest);

                for(Segment seg : segments)
                {
                    FileInputStream in = new FileInputStream(seg.getTempFile());

                    int b;
                    while((b = in.read()) != -1)
                    {
                        out.write(b);
                    }

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

                    if(!seg.getTempFile().delete())
                    {
                        Logger.post(Logger.Level.WARNING, "Could not delete temp file: " + seg.getTempFile());
                    }
                }

                out.close();

                status = "Done";
                Mediator.post(new DownloadStatusChanged(this));

                Logger.post(Logger.Level.INFO, "Finished download: " + getName());
            }
            catch(IOException ex)
            {
View Full Code Here

Examples of net.sf.gimme.event.DownloadStatusChanged

    public void pause()
    {
        if(!finished)
        {
            status = "Paused";
            Mediator.post(new DownloadStatusChanged(this));

            for(Segment seg : segments)
            {
                seg.pause();
            }
View Full Code Here

Examples of net.sf.gimme.event.DownloadStatusChanged

    public void resume()
    {
        if(!finished)
        {
            status = "Downloading...";
            Mediator.post(new DownloadStatusChanged(this));

            for(Segment seg : segments)
            {
                seg.resume();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.