Libraryless. Click here for Pure Java version (3854L/22K).
asclass InputStreamPlusReadFully extends InputStream { public void readFully(byte[] destination) throws IOException { readFully(destination, 0, destination.length); } public void readFully(byte[] destination, int offset, int length) throws IOException { int read = 0; while (read < length) { int r = read(destination, offset+read, length-read); if (r == -1) throw new EOFException("Asked to read " + length + " bytes from " + offset + " but hit EoF at " + read); else read += r; } } }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032912 |
Snippet name: | InputStreamPlusReadFully |
Eternal ID of this version: | #1032912/8 |
Text MD5: | 10e21f637fef184f90b64bd63dff5e38 |
Transpilation MD5: | bf451474177cb756460903523d34d4d5 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-10 21:36:13 |
Source code size: | 567 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 165 / 293 |
Version history: | 7 change(s) |
Referenced in: | [show references] |