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

26
LINES

< > BotCompany Repo | #2000354 // class virtual (fixed 4)

New Tinybrain snippet

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.FileInputStream newFileInputStream(String path) throws java.io.IOException {
11  
    return new java.io.FileInputStream(rebase(path));
12  
  }
13  
  
14  
  static java.io.FileOutputStream newFileOutputStream(String path) throws java.io.IOException {
15  
    return new java.io.FileOutputStream(rebase(path));
16  
  }
17  
  
18  
  static String virtual_baseDir = "";
19  
  
20  
  static String rebase(String path) {
21  
    if (new File(path).isAbsolute())
22  
      return path;
23  
    else
24  
      return new File(new File(virtual_baseDir), path).getAbsolutePath();
25  
  }
26  
}

Author comment

Began life as a copy of #2000353

download  show line numbers   

Snippet is not live.

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

No comments. add comment

Snippet ID: #2000354
Snippet name: class virtual (fixed 4)
Eternal ID of this version: #2000354/1
Text MD5: 3761aad86f1624269723a06c4042d98f
Author: stefan
Category: javax
Type: New Tinybrain snippet
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-05-12 21:04:53
Source code size: 776 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 537 / 127
Referenced in: [show references]