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)

class virtual {
  static java.io.File newFile(String path) {
    return new java.io.File(rebase(path));
  }
  
  static java.io.File newFile(File base, String path) {
    return new java.io.File(base, path);
  }
  
  static java.io.File newFile(String base, String path) {
    return new java.io.File(rebase(base), path);
  }
  
  static java.io.FileInputStream newFileInputStream(String path) throws java.io.IOException {
    return new java.io.FileInputStream(rebase(path));
  }
  
  static java.io.FileOutputStream newFileOutputStream(String path) throws java.io.IOException {
    return new java.io.FileOutputStream(rebase(path));
  }
  
  static java.io.FileOutputStream newFileOutputStream(String path, boolean append) throws java.io.IOException {
    return new java.io.FileOutputStream(rebase(path), append);
  }
  
  static java.io.FileInputStream newFileInputStream(File path) throws java.io.IOException {
    return new java.io.FileInputStream(rebase(path));
  }
  
  static java.io.FileOutputStream newFileOutputStream(File path) throws java.io.IOException {
    return new java.io.FileOutputStream(rebase(path));
  }
  
  static String virtual_baseDir = "";
  
  static String rebase(String path) {
    if (new File(path).isAbsolute())
      return path;
    else
      return new File(new File(virtual_baseDir), path).getAbsolutePath();
  }
  
  static File rebase(File file) {
    return new File(rebase(file.getPath()));
  }
}

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: 565 / 56883
Version history: 1 change(s)
Referenced in: [show references]