Skip to content

Practice 02 Loading Binary Files

squid233 edited this page Apr 6, 2024 · 4 revisions

We can load binary files into MemorySegment and manage them with Arena.

See IOUtil.java for more infomation.

Example

try (var is = ClassLoader.getSystemResourceAsStream("path")) {
    var seg = arena.allocateFrom(JAVA_BYTE, is.readAllBytes());
    // use the data...
}
Clone this wiki locally