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

14
LINES

< > BotCompany Repo | #1027355 // drainStreamToPrint_charByChar_onChar_onLine

JavaX fragment (include)

svoid drainStreamToPrint_charByChar_onChar_onLine(InputStream stream, IF0<Bool> enabled, IVF1<Char> onChar, 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);
      callF(onChar, (char) c);
      buf.append(s);
      if (c == '\n') callF(onLine, getAndClearStringBuilder(buf));
    }
  }
}

Author comment

Began life as a copy of #1027354

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: #1027355
Snippet name: drainStreamToPrint_charByChar_onChar_onLine
Eternal ID of this version: #1027355/1
Text MD5: c299dd74d782c4d75115f5f5e06d6f2b
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:53:21
Source code size: 471 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 96 / 124
Referenced in: [show references]