Changeset 641 for AE/installer2/src/net/oni2/aeinstaller/backend/network
- Timestamp:
- Jan 21, 2013, 12:14:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/backend/network/FileDownloader.java
r634 r641 48 48 private URL url = null; 49 49 private File target = null; 50 private int size = -1;50 private int fileLength = Integer.MAX_VALUE; 51 51 private int downloaded = 0; 52 52 … … 64 64 this.url = new URL(url); 65 65 this.target = target; 66 67 URLConnection connection = this.url.openConnection();68 connection.connect();69 size = connection.getContentLength();70 66 } 71 67 … … 94 90 t.start(); 95 91 state = EState.RUNNING; 96 updateStatus(downloaded, size);97 92 } 98 93 } … … 108 103 else 109 104 state = EState.RUNNING; 110 updateStatus(downloaded, size);105 updateStatus(downloaded, fileLength); 111 106 } 112 107 } … … 149 144 public void run() { 150 145 int downloaded = 0; 151 int fileLength = Integer.MAX_VALUE;152 146 String strLastModified = null; 153 147 String strEtag = null; … … 181 175 try { 182 176 URLConnection connection = url.openConnection(); 177 connection.setRequestProperty("Cache-Control", "no-cache"); 183 178 if (downloaded == 0) { 184 179 connection.connect(); … … 257 252 258 253 /** 259 * @return the size260 */261 public int getSize() {262 return size;263 }264 265 /**266 254 * @return the downloaded size 267 255 */
Note:
See TracChangeset
for help on using the changeset viewer.