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

11
LINES

< > BotCompany Repo | #1014510 // streamLength - also closes stream

JavaX fragment (include)

1  
static long streamLength(InputStream in) ctex {
2  
  temp tempCloseStream(in);
3  
  byte[] buf = new byte[65536];
4  
  long total = 0;
5  
  while (true) {
6  
    int n = in.read(buf);
7  
    if (n <= 0) break;
8  
    total += n;
9  
  }
10  
  ret total;
11  
}

Author comment

Began life as a copy of #1000844

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: #1014510
Snippet name: streamLength - also closes stream
Eternal ID of this version: #1014510/1
Text MD5: cca5aee745ff4d6e21aef9817b6bea4d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-22 22:35:26
Source code size: 236 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 382 / 424
Referenced in: [show references]