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

15
LINES

< > BotCompany Repo | #1000535 // loadSnippetAndTitle

JavaX fragment (include)

// for now, no caching...
static String[] loadSnippetAndTitle(String id) throws IOException {
  long snippetID = parseSnippetID(id);
  
  String json;
  try {
    URL url = new URL(tb_mainServer() + "/tb-int/get.php?id=" + snippetID + "&full=1");
    json = loadPage(url);
  } catch (RuntimeException e) { // TODO: test for nested IOException
    throw new IOException("Snippet #" + snippetID + " not found or not public");
  }

  Map<String, String> map = jsonDecodeMap(json);
  return new String[] {map.get("text"), map.get("title")};
}

Author comment

Requires class JsonTok (!include #728)

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

2 comment(s) hidden. show

Snippet ID: #1000535
Snippet name: loadSnippetAndTitle
Eternal ID of this version: #1000535/2
Text MD5: d5b7cb4ca24166aea4155e5ceb91796e
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-26 13:23:22
Source code size: 554 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 959 / 1256
Version history: 1 change(s)
Referenced in: [show references]