Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > TinyBrain | #1008031 - loadDataSnippetToFile

JavaX fragment (include)

static File loadDataSnippetToFile(S snippetID) ctex {
  File f = DiskSnippetCache_file(parseSnippetID(snippetID));
  try {
    URL url = new URL(dataSnippetLink(snippetID));
    System.err.println("Loading library: " + hideCredentials(url));
    try {
      loadBinaryPageToFile(openConnection(url), f);
      if (fileSize(f) == 0) fail();
    } catch {
      url = new URL("http://data.tinybrain.de/blobs/"
        + parseSnippetID(snippetID));
      loadBinaryPageToFile(openConnection(url), f);
    }
    // TODO: check if we hit the "LOADING" message
    if (fileSize(f) == 0) fail();
    System.err.println("Bytes loaded: " + fileSize(f));
  } catch e {
    printStackTrace(e);
    fail("Binary snippet #" + snippetID + " not found or not public");
  }
  return f;
}

Author comment

Began life as a copy of #1000675

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1008031
Snippet name: loadDataSnippetToFile
Eternal ID of this version: #1008031/15
Text MD5: 79ad1e0a82d7c619d6129d48d6635636
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-14 15:17:44
Source code size: 792 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 56 / 48
Version history: 14 change(s)
Referenced in: [show]