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

13
LINES

< > BotCompany Repo | #1006742 // loadBinaryFilePart

JavaX fragment (include)

static byte[] loadBinaryFilePart(File file, long start, long end) ctex {
  if (file == null) null;
  RandomAccessFile raf = new RandomAccessFile(file, "r");
  int n = toInt(min(raf.length(), end-start));
  byte[] buffer = new byte[n];
  try {
    raf.seek(start);
    raf.readFully(buffer, 0, n);
    return buffer;
  } finally {
    raf.close();
  }
}

Author comment

Began life as a copy of #1006741

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, qsqiayxyrbia, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006742
Snippet name: loadBinaryFilePart
Eternal ID of this version: #1006742/8
Text MD5: c23c75952c8a4256f218fc04518216fc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-14 14:53:18
Source code size: 364 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 587 / 874
Version history: 7 change(s)
Referenced in: [show references]