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

46
LINES

< > BotCompany Repo | #1004414 // class virtual (LIVE)

JavaX fragment (include)

1  
class virtual {
2  
  static java.io.File newFile(String path) {
3  
    return new java.io.File(rebase(path));
4  
  }
5  
  
6  
  static java.io.File newFile(File base, String path) {
7  
    return new java.io.File(base, path);
8  
  }
9  
  
10  
  static java.io.File newFile(String base, String path) {
11  
    return new java.io.File(rebase(base), path);
12  
  }
13  
  
14  
  static java.io.FileInputStream newFileInputStream(String path) throws java.io.IOException {
15  
    return new java.io.FileInputStream(rebase(path));
16  
  }
17  
  
18  
  static java.io.FileOutputStream newFileOutputStream(String path) throws java.io.IOException {
19  
    return new java.io.FileOutputStream(rebase(path));
20  
  }
21  
  
22  
  static java.io.FileOutputStream newFileOutputStream(String path, boolean append) throws java.io.IOException {
23  
    return new java.io.FileOutputStream(rebase(path), append);
24  
  }
25  
  
26  
  static java.io.FileInputStream newFileInputStream(File path) throws java.io.IOException {
27  
    return new java.io.FileInputStream(rebase(path));
28  
  }
29  
  
30  
  static java.io.FileOutputStream newFileOutputStream(File path) throws java.io.IOException {
31  
    return new java.io.FileOutputStream(rebase(path));
32  
  }
33  
  
34  
  static String virtual_baseDir = "";
35  
  
36  
  static String rebase(String path) {
37  
    if (new File(path).isAbsolute())
38  
      return path;
39  
    else
40  
      return new File(new File(virtual_baseDir), path).getAbsolutePath();
41  
  }
42  
  
43  
  static File rebase(File file) {
44  
    return new File(rebase(file.getPath()));
45  
  }
46  
}

Author comment

Began life as a copy of #2000355

download  show line numbers  debug dex  old transpilations   

Travelled to 30 computer(s): ajlfxifxfcul, aoiabmzegqzx, ayfdnjdhpjha, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, fonkrhpcolwg, gjtlkbvenryc, gwrvuhgaqvyk, imzmzdywqqli, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, kltaiputbqfu, lpdgvwnxivlt, lulzaavyztxj, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, wtqryiryparv, xinetxnxrdbb

No comments. add comment

Snippet ID: #1004414
Snippet name: class virtual (LIVE)
Eternal ID of this version: #1004414/2
Text MD5: 2ce275a7628eb3a5305056bac5ddcf0d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-17 23:17:30
Source code size: 1487 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 567 / 56891
Version history: 1 change(s)
Referenced in: [show references]