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

13
LINES

< > BotCompany Repo | #1027354 // drainStreamToPrint_charByChar_onLine

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

Libraryless. Click here for Pure Java version (2207L/14K).

svoid drainStreamToPrint_charByChar_onLine(InputStream stream, IF0<Bool> enabled, IVF1<S> onLine) ctex {
  InputStreamReader in = new(stream);
  new StringBuilder buf;
  int c;
  while ((c = in.read()) >= 0) {
    if (enabled == null || enabled!) {
      S s = str((char) c);
      print_noNewLine(s);
      buf.append(s);
      if (c == '\n') callF(onLine, getAndClearStringBuilder(buf));
    }
  }
}

Author comment

Began life as a copy of #1027353

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027354
Snippet name: drainStreamToPrint_charByChar_onLine
Eternal ID of this version: #1027354/2
Text MD5: b1d8d16c74d0be254d0220c2397c1ae6
Transpilation MD5: 8634eec4ed4e963730700dee461050f8
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-11 15:47:55
Source code size: 413 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 88 / 145
Version history: 1 change(s)
Referenced in: [show references]