Libraryless. Click here for Pure Java version (3366L/21K).
1 | sclass ROMIntMemoryFromFile implements IIntMemory, AutoCloseable {
|
2 | File file; |
3 | int size; |
4 | RandomAccessFile raf; |
5 | bool bigEndian; |
6 | |
7 | *(File *file) {
|
8 | size = toInt_safe(fileSize(file)/4); |
9 | raf = randomAccessFileForReading(file); |
10 | } |
11 | |
12 | public void close {
|
13 | dispose raf; |
14 | } |
15 | |
16 | public int get(int idx) ctex {
|
17 | rangeCheck(idx, size); |
18 | raf.seek(idx*4L); |
19 | ret bigEndian ? raf.readInt() : raf_readLittleEndianInt(raf); |
20 | } |
21 | |
22 | public void set(int idx, int val) {
|
23 | fail("read-only");
|
24 | } |
25 | |
26 | public int size() {
|
27 | ret size; |
28 | } |
29 | } |
Began life as a copy of #1029248
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: | #1029250 |
| Snippet name: | ROMIntMemoryFromFile |
| Eternal ID of this version: | #1029250/5 |
| Text MD5: | edf3862118e9908a6e7524160a67f153 |
| Transpilation MD5: | 4b08607af824e1a56395b9ac9de5ff10 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-08-02 20:23:50 |
| Source code size: | 585 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 541 / 883 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |