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).

static File createTempFile() {
  ret createTempFile("tmp", null);
}

static File createTempFile(S prefix, S suffix) ctex {
  prefix = nohup_sanitize(prefix);
  suffix = nohup_sanitize(suffix);
  if (shouldKeepTempFiles())
    ret mkdirsForFile(javaxCachesDir("Temp/" + prefix + "-" + randomID() + "-" + suffix));
  // File.createTempFile needs at least 3 prefix characters, so we
  // fíll them up for you
  File f = File.createTempFile(takeFirst(10, pad(prefix, 3, '-')), suffix);
  f.deleteOnExit();
  ret f;
}

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: 671 / 820
Version history: 11 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026327 - createTempFileWithExtension
#1031951 - tempTextFile