Package slash.navigation.download.actions

Examples of slash.navigation.download.actions.Copier


        InputStream inputStream = get.executeAsStream();
        log.info(format("Resume from %s returned with status code %s", download.getUrl(), get.getStatusCode()));
        if (get.isPartialContent()) {
            modelUpdater.expectingBytes(contentLength != null ? contentLength : get.getContentLength() != null ? get.getContentLength() : 0);
            new Copier(modelUpdater).copyAndClose(inputStream, new FileOutputStream(download.getTempFile(), true), fileSize, contentLength);
            return true;
        }
        return false;
    }
View Full Code Here


        log.info(format("Download from %s returned with status code %s", download.getUrl(), get.getStatusCode()));
        if (get.isSuccessful() && inputStream != null) {
            if(contentLength == null)
                contentLength = get.getContentLength();
            modelUpdater.expectingBytes(contentLength != null ? contentLength : 0);
            new Copier(modelUpdater).copyAndClose(inputStream, new FileOutputStream(download.getTempFile()), 0, contentLength);
            download.setETag(get.getETag());
            return true;
        }
        return false;
    }
View Full Code Here

    }

    private void copy() throws IOException {
        File target = download.getFile().getFile();
        ensureDirectory(target.getParent());
        new Copier(modelUpdater).copyAndClose(download.getTempFile(), target);
        setLastModified(target, fromMillis(get.getLastModified()));
    }
View Full Code Here

TOP

Related Classes of slash.navigation.download.actions.Copier

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.