Search in sources :

Example 1 with ProgressInputStream

use of org.jabref.logic.net.ProgressInputStream in project jabref by JabRef.

the class FileDownloadTask method call.

@Override
protected Void call() throws Exception {
    URLDownload download = new URLDownload(source);
    try (ProgressInputStream inputStream = download.asInputStream()) {
        EasyBind.subscribe(inputStream.totalNumBytesReadProperty(), bytesRead -> updateProgress(bytesRead.longValue(), inputStream.getMaxNumBytes()));
        Files.copy(inputStream, destination, StandardCopyOption.REPLACE_EXISTING);
    }
    return null;
}
Also used : ProgressInputStream(org.jabref.logic.net.ProgressInputStream) URLDownload(org.jabref.logic.net.URLDownload)

Aggregations

ProgressInputStream (org.jabref.logic.net.ProgressInputStream)1 URLDownload (org.jabref.logic.net.URLDownload)1