Package slash.navigation.download.actions

Examples of slash.navigation.download.actions.Validator


        updateState(download, Downloading);
        Long contentLength = download.getFile().getExpectedChecksum() != null ? download.getFile().getExpectedChecksum().getContentLength() : null;
        log.info(format("Downloading %d bytes from %s with ETag %s", contentLength, download.getUrl(), download.getETag()));

        get = new Get(download.getUrl());
        if (new Validator(download).existTargets() && download.getETag() != null)
            get.setIfNoneMatch(download.getETag());

        InputStream inputStream = get.executeAsStream();
        log.info(format("Download from %s returned with status code %s", download.getUrl(), get.getStatusCode()));
        if (get.isSuccessful() && inputStream != null) {
View Full Code Here


    }

    private boolean validate() throws IOException {
        updateState(download, Validating);

        Validator validator = new Validator(download);
        validator.validate();

        if (!validator.existTargets()) {
            updateState(download, NoFileError);
            return false;
        } else if (!validator.isChecksumValid()) {
            updateState(download, ChecksumError);
            return false;
        }
        return true;
    }
View Full Code Here

TOP

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

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.