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

15
LINES

< > BotCompany Repo | #1009093 // createTempFile

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

Libraryless. Click here for Pure Java version (2375L/15K).

1  
static File createTempFile() {
2  
  ret createTempFile("tmp", null);
3  
}
4  
5  
static File createTempFile(S prefix, S suffix) ctex {
6  
  prefix = nohup_sanitize(prefix);
7  
  suffix = nohup_sanitize(suffix);
8  
  if (shouldKeepTempFiles())
9  
    ret mkdirsForFile(javaxCachesDir("Temp/" + prefix + "-" + randomID() + "-" + suffix));
10  
  // File.createTempFile needs at least 3 prefix characters, so we
11  
  // fíll them up for you
12  
  File f = File.createTempFile(takeFirst(10, pad(prefix, 3, '-')), suffix);
13  
  f.deleteOnExit();
14  
  ret f;
15  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009093
Snippet name: createTempFile
Eternal ID of this version: #1009093/12
Text MD5: 252bed2ff1c5541a07debc85bc3a0d7f
Transpilation MD5: 29f2e703de696d8b866007227154bff1
Author: stefan
Category: javax / i.o.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-20 16:30:48
Source code size: 527 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 672 / 821
Version history: 11 change(s)
Referenced in: [show references]