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

17
LINES

< > BotCompany Repo | #1005202 // loadBinaryFileChunk

JavaX fragment (include)

static byte[] loadBinaryFileChunk(File f, long start, int l) ctex {
  byte[] buf = new byte[l];
  RandomAccessFile raf = new RandomAccessFile(f, "r");
  try {
    raf.seek(start);
    raf.readFully(buf);
    ret buf;
  } finally {
    raf.close();
  }
}

ifclass LongRange
static byte[] loadBinaryFileChunk(File f, LongRange r) {
  ret loadBinaryFileChunk(f, r.start, toInt_checked(r.length()));
}
endif

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1005202
Snippet name: loadBinaryFileChunk
Eternal ID of this version: #1005202/2
Text MD5: 208c29b238d0b0440cc0be98e8fd8263
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-28 00:54:53
Source code size: 419 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 534 / 531
Version history: 1 change(s)
Referenced in: [show references]