1 | static S hijackPrint_tee(Runnable r) { |
2 | final new StringBuilder buf; |
3 | O old = interceptPrintInThisThread(new F1<S, Bool>() { |
4 | Bool get(S s) { |
5 | buf.append(s); |
6 | true; |
7 | } |
8 | }); |
9 | try { |
10 | callF(r); |
11 | ret str(buf); |
12 | } finally { |
13 | interceptPrintInThisThread(old); |
14 | } |
15 | } |
Began life as a copy of #1011313
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012290 |
Snippet name: | hijackPrint_tee - hijack the print function for a function call, return printed contents, also print normally |
Eternal ID of this version: | #1012290/2 |
Text MD5: | 9b7ff48b1303b38cbd03e9ae58c57bad |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-27 12:47:59 |
Source code size: | 302 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 431 / 468 |
Version history: | 1 change(s) |
Referenced in: | [show references] |