Libraryless. Click here for Pure Java version (63L/1K).
public static byte[] loadBinaryFile(String fileName, int bufSize default defaultBufferedOutputStreamSize()) { try { if (!new File(fileName).exists()) return null; FileInputStream in = new FileInputStream(fileName); byte buf[] = new byte[bufSize]; ByteArrayOutputStream out = new ByteArrayOutputStream(); int l; while (true) { l = in.read(buf); if (l <= 0) break; out.write(buf, 0, l); } in.close(); return out.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } public static byte[] loadBinaryFile(File file, int bufSize default defaultBufferedOutputStreamSize()) { return loadBinaryFile(file.getPath(), bufSize); }
Began life as a copy of #2000553
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000744 |
Snippet name: | loadBinaryFile |
Eternal ID of this version: | #1000744/6 |
Text MD5: | 1ad63989f76c87aa5b770f02b1603089 |
Transpilation MD5: | 8f7c978937ff23b7d7ee966fbb67053f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-08 14:46:07 |
Source code size: | 704 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 751 / 4797 |
Version history: | 5 change(s) |
Referenced in: | [show references] |