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

1  
svoid drainStreamToPrint_charByChar_onLine(InputStream stream, IF0<Bool> enabled, IVF1<S> onLine) ctex {
2  
  InputStreamReader in = new(stream);
3  
  new StringBuilder buf;
4  
  int c;
5  
  while ((c = in.read()) >= 0) {
6  
    if (enabled == null || enabled!) {
7  
      S s = str((char) c);
8  
      print_noNewLine(s);
9  
      buf.append(s);
10  
      if (c == '\n') callF(onLine, getAndClearStringBuilder(buf));
11  
    }
12  
  }
13  
}

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: 147 / 222
Version history: 1 change(s)
Referenced in: [show references]