Libraryless. Click here for Pure Java version (3047L/17K).
1 | sclass ShortArrayInputStream extends InputStream {
|
2 | short[] buf; |
3 | int iBuf; |
4 | int mark_iBuf; |
5 | bool bigEndian; |
6 | |
7 | *(short[] *buf) {}
|
8 | |
9 | public bool markSupported() { true; }
|
10 | |
11 | public void mark(int n) {
|
12 | mark_iBuf = iBuf; |
13 | } |
14 | |
15 | public void reset() {
|
16 | iBuf = mark_iBuf; |
17 | } |
18 | |
19 | public int read() {
|
20 | if (iBuf >= l(buf)*2) ret -1; |
21 | short s = buf[iBuf/2]; |
22 | int i = (odd(iBuf) != bigEndian ? s >> 8 : s) & 0xFF; |
23 | iBuf++; |
24 | ret i; |
25 | } |
26 | } |
Began life as a copy of #1019269
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1031898 |
| Snippet name: | ShortArrayInputStream - reads from short[] |
| Eternal ID of this version: | #1031898/6 |
| Text MD5: | 00f54e6918b4f1ebdb15b94d82b65748 |
| Transpilation MD5: | 1a7ac4dbad665b20fb40a428fe5775e3 |
| Author: | stefan |
| Category: | javax / io |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-07-24 06:47:29 |
| Source code size: | 487 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 400 / 604 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |