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).

sclass IntArrayInputStream_littleEndian extends InputStream {
  int[] buf;
  int to;
  int iBuf, j;
  
  *(int[] *buf) { to = l(buf); }
  *(int[] *buf, int from, int *to) { iBuf = from; }
  
  public int read() {
    if (iBuf >= to) ret -1;
    int x = buf[iBuf];
    int out = (x >>> (j*8)) & 0xFF;
    if (++j >= 4) { ++iBuf; j = 0; }
    ret out;
  }
}

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: 221 / 500
Version history: 5 change(s)
Referenced in: [show references]