Libraryless. Click here for Pure Java version (6647L/38K).
1 | // If you change this, also change DiskSnippetCache_fileToLibID |
2 | static File DiskSnippetCache_file(long snippetID) {
|
3 | ret new File(getGlobalCache(), "data_" + snippetID + ".jar"); |
4 | } |
5 | |
6 | // Data files are immutable, use centralized cache |
7 | public static File DiskSnippetCache_getLibrary(long snippetID) throws IOException {
|
8 | File file = DiskSnippetCache_file(snippetID); |
9 | return file.exists() ? file : null; |
10 | } |
11 | |
12 | public static File DiskSnippetCache_getLibrary(S snippetID) ctex {
|
13 | ret DiskSnippetCache_getLibrary(psI(snippetID)); |
14 | } |
15 | |
16 | public static void DiskSnippetCache_putLibrary(long snippetID, byte[] data) throws IOException {
|
17 | saveBinaryFile(DiskSnippetCache_file(snippetID), data); |
18 | } |
19 | |
20 | static byte[] loadDataSnippetImpl(String snippetID) throws IOException {
|
21 | byte[] data; |
22 | try {
|
23 | URL url = new URL(dataSnippetLink(snippetID)); |
24 | print("Loading library: " + hideCredentials(url));
|
25 | try {
|
26 | data = loadBinaryPage(url.openConnection()); |
27 | } catch (RuntimeException e) {
|
28 | data = null; |
29 | } |
30 | |
31 | if (data == null || data.length == 0) {
|
32 | url = new URL(tb_mainServer() + "/blobs/" + parseSnippetID(snippetID)); |
33 | print("Loading library: " + hideCredentials(url));
|
34 | data = loadBinaryPage(url.openConnection()); |
35 | } |
36 | print("Bytes loaded: " + data.length);
|
37 | } catch (FileNotFoundException e) {
|
38 | throw new IOException("Binary snippet #" + snippetID + " not found or not public");
|
39 | } |
40 | return data; |
41 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1000675 |
| Snippet name: | loadDataSnippetImpl etc. - todo: merge with loadDataSnippetToFile |
| Eternal ID of this version: | #1000675/10 |
| Text MD5: | 099590a062f9bcb2c07822d9c6374476 |
| Transpilation MD5: | 4e8be385e4af4f1c9e86c4079754508f |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-02-06 00:48:10 |
| Source code size: | 1481 bytes / 41 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1254 / 3697 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |