1 | static void loadBinaryPageToFile(S url, File file) ctex {
|
2 | print("Loading " + url);
|
3 | loadBinaryPageToFile(openConnection(new URL(url)), file); |
4 | } |
5 | |
6 | static void loadBinaryPageToFile(URLConnection con, File file) ctex {
|
7 | setHeaders(con); |
8 | loadBinaryPageToFile_noHeaders(con, file); |
9 | } |
10 | |
11 | static void loadBinaryPageToFile_noHeaders(URLConnection con, File file) ctex {
|
12 | assertNotNull(file); |
13 | File ftemp = new File(f2s(file) + "_temp"); |
14 | FileOutputStream buf = newFileOutputStream(mkdirsFor(ftemp)); |
15 | try {
|
16 | InputStream inputStream = con.getInputStream(); |
17 | long len = 0; |
18 | try { len = con.getContentLength/*Long*/(); } catch (Throwable e) { printStackTrace(e); }
|
19 | S pat = " {*}" + (len != 0 ? "/" + len : "") + " bytes loaded.";
|
20 | copyStreamWithPrints(inputStream, buf, pat); |
21 | inputStream.close(); |
22 | buf.close(); |
23 | file.delete(); |
24 | renameFile_assertTrue(ftemp, file); |
25 | } finally {
|
26 | if (buf != null) buf.close(); |
27 | } |
28 | } |
Began life as a copy of #1000837
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008030 |
| Snippet name: | loadBinaryPageToFile |
| Eternal ID of this version: | #1008030/13 |
| Text MD5: | 64b4f613fe7d884bab75b500175bcbc2 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-09-25 22:22:49 |
| Source code size: | 972 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 985 / 1093 |
| Version history: | 12 change(s) |
| Referenced in: | [show references] |