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

16
LINES

< > BotCompany Repo | #1029246 // IntArrayInputStream_littleEndian

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2491L/16K).

1  
sclass IntArrayInputStream_littleEndian extends InputStream {
2  
  int[] buf;
3  
  int to;
4  
  int iBuf, j;
5  
  
6  
  *(int[] *buf) { to = l(buf); }
7  
  *(int[] *buf, int from, int *to) { iBuf = from; }
8  
  
9  
  public int read() {
10  
    if (iBuf >= to) ret -1;
11  
    int x = buf[iBuf];
12  
    int out = (x >>> (j*8)) & 0xFF;
13  
    if (++j >= 4) { ++iBuf; j = 0; }
14  
    ret out;
15  
  }
16  
}

Author comment

Began life as a copy of #1018606

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: #1029246
Snippet name: IntArrayInputStream_littleEndian
Eternal ID of this version: #1029246/6
Text MD5: 3de249925c7c65d9512c8a2a7ef2c246
Transpilation MD5: a2bbfcf8696450992026dcfab274a824
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-27 13:29:13
Source code size: 370 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 223 / 505
Version history: 5 change(s)
Referenced in: [show references]