Bladeren bron

Move indeterminate setting into listening stream.

pull/22/head
Greg Holmes 9 jaren geleden
bovenliggende
commit
e91abf5d35
2 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 0
    3
      src/com/dmdirc/util/io/Downloader.java
  2. 3
    0
      src/com/dmdirc/util/io/ListenerInputStream.java

+ 0
- 3
src/com/dmdirc/util/io/Downloader.java Bestand weergeven

@@ -108,9 +108,6 @@ public class Downloader {
108 108
      */
109 109
     public void downloadPage(final String url, final Path file, final DownloadListener listener)
110 110
             throws IOException {
111
-        if (listener != null) {
112
-            listener.setIndeterminate(true);
113
-        }
114 111
         final URLConnection connection = getConnection(url, "");
115 112
         Files.copy(new ListenerInputStream(connection.getInputStream(), listener,
116 113
                         connection.getContentLength()), file);

+ 3
- 0
src/com/dmdirc/util/io/ListenerInputStream.java Bestand weergeven

@@ -53,6 +53,9 @@ public class ListenerInputStream extends FilterInputStream {
53 53
         this.length = length;
54 54
         count = 0;
55 55
         mark = count;
56
+        if (length == -1) {
57
+            listener.setIndeterminate(true);
58
+        }
56 59
     }
57 60
 
58 61
     @Override

Laden…
Annuleren
Opslaan