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

14
LINES

< > BotCompany Repo | #1023829 // loadPageAndStore_once - load page and store in a file derived from URL, or get from disk

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3495L/24K).

1  
sS loadPageAndStore_once(S url) {
2  
  File f = defaultPlaceForStoredWebPage(url);
3  
  if (f.exists()) ret loadTextFile(f);
4  
  S page;
5  
  try {
6  
    page = loadPage(url);
7  
  } catch e {
8  
    print(e);
9  
    page = "ERROR: " + e;
10  
  }
11  
  saveTextFile(f, page);
12  
  saveTextFile(replaceExtension(f, ".url"), url);
13  
  ret page;
14  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1023829
Snippet name: loadPageAndStore_once - load page and store in a file derived from URL, or get from disk
Eternal ID of this version: #1023829/4
Text MD5: 8647b37502832afe399ea71065daa7f5
Transpilation MD5: 323320f663193f3aa99c9b2b3d88a62c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-11 12:54:57
Source code size: 322 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 389
Version history: 3 change(s)
Referenced in: [show references]