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

17
LINES

< > BotCompany Repo | #1005202 // loadBinaryFileChunk

JavaX fragment (include)

1  
static byte[] loadBinaryFileChunk(File f, long start, int l) ctex {
2  
  byte[] buf = new byte[l];
3  
  RandomAccessFile raf = new RandomAccessFile(f, "r");
4  
  try {
5  
    raf.seek(start);
6  
    raf.readFully(buf);
7  
    ret buf;
8  
  } finally {
9  
    raf.close();
10  
  }
11  
}
12  
13  
ifclass LongRange
14  
static byte[] loadBinaryFileChunk(File f, LongRange r) {
15  
  ret loadBinaryFileChunk(f, r.start, toInt_checked(r.length()));
16  
}
17  
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: 607 / 603
Version history: 1 change(s)
Referenced in: [show references]