!636 !standard functions main { psvm { File file = loadDataSnippet("#1000304"); // jar file (1.x MB) System.out.println(file); System.out.println(" " + file.length()); } static File loadDataSnippet(String snippetID) throws IOException { File libraryFile = DiskSnippetCache_getLibrary(parseSnippetID(snippetID)); if (libraryFile == null) { byte[] data = loadDataSnippetImpl(snippetID); DiskSnippetCache_putLibrary(parseSnippetID(snippetID), data); libraryFile = DiskSnippetCache_getLibrary(parseSnippetID(snippetID)); } return libraryFile; } static byte[] loadDataSnippetImpl(String snippetID) throws IOException { byte[] data; try { URL url = new URL("http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_" + parseSnippetID(snippetID) + "&contentType=application/binary"); System.err.println("Loading library: " + url); data = loadBinaryPage(url.openConnection()); } catch (FileNotFoundException e) { throw new IOException("Binary snippet #" + snippetID + " not found or not public"); } return data; } public static synchronized File DiskSnippetCache_getLibrary(long snippetID) throws IOException { initSnippetCache(); File file = new File(DiskSnippetCache_dir, "data_" + snippetID + ".jar"); return file.exists() ? file : null; } public static synchronized void DiskSnippetCache_putLibrary(long snippetID, byte[] data) throws IOException { initSnippetCache(); saveBinaryFile(new File(DiskSnippetCache_dir, "data_" + snippetID).getPath() + ".jar", data); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000345 |
Snippet name: | loadDataSnippet (developing) |
Eternal ID of this version: | #1000345/1 |
Text MD5: | 97b7c6d0b07f22f9a4955049bdee0461 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-07-26 20:29:53 |
Source code size: | 1668 bytes / 44 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 754 / 603 |
Referenced in: | [show references] |