Explorar el Código

Move indeterminate setting into listening stream.

pull/22/head
Greg Holmes hace 9 años
padre
commit
e91abf5d35

+ 0
- 3
src/com/dmdirc/util/io/Downloader.java Ver fichero

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

+ 3
- 0
src/com/dmdirc/util/io/ListenerInputStream.java Ver fichero

53
         this.length = length;
53
         this.length = length;
54
         count = 0;
54
         count = 0;
55
         mark = count;
55
         mark = count;
56
+        if (length == -1) {
57
+            listener.setIndeterminate(true);
58
+        }
56
     }
59
     }
57
 
60
 
58
     @Override
61
     @Override

Loading…
Cancelar
Guardar