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

12
LINES

< > BotCompany Repo | #1013671 // copyStreamWithPrints

JavaX fragment (include)

1  
static void copyStreamWithPrints(InputStream in, OutputStream out, S pat) ctex {
2  
  byte[] buf = new byte[65536];
3  
  int total = 0;
4  
  while (true) {
5  
    int n = in.read(buf);
6  
    if (n <= 0) return;
7  
    out.write(buf, 0, n);
8  
    if ((total+n)/100000 > total/100000)
9  
      print(pat.replace("{*}", str(roundDownTo(100000, total))));
10  
    total += n;
11  
  }
12  
}

Author comment

Began life as a copy of #1000844

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1013671
Snippet name: copyStreamWithPrints
Eternal ID of this version: #1013671/4
Text MD5: da75c4364507f9c6aec82a148bf962ce
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-29 12:53:23
Source code size: 362 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 485 / 513
Version history: 3 change(s)
Referenced in: [show references]