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

6
LINES

< > BotCompany Repo | #1016944 // trimmedFileLiveValue

JavaX fragment (include)

// returns (live value, updater)
static Pair<SimpleLiveValue<S>, Runnable> trimmedFileLiveValue(final File f, fS defaultValue) {
  final SimpleLiveValue<S> lv = stringLiveValue(trim(loadTextFile(f, defaultValue)));
  lv.onChange(r { saveTextFileIfDifferent(f, lv!) });
  ret pair(lv, (Runnable) r { lv.set(trim(loadTextFile(f, defaultValue))) });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016944
Snippet name: trimmedFileLiveValue
Eternal ID of this version: #1016944/8
Text MD5: 5d53af4fb0d75a4595ca8eb3a5142fc0
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-09 13:33:12
Source code size: 353 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 385 / 427
Version history: 7 change(s)
Referenced in: [show references]