I have a Java application that takes up a lot of char arrays, byte arrays, and String objects. A lot these object allocations can be saved if I can find a way to create a char array from an arbitrary pointer addresses. Java, as it stands, does not allow you to do this, even with the Unsafe class. Normally operations like this are ill-advised, but these objects are coming from a read-only memory map. So the application will crash if I try to write to them.
I’ve been doing some research on Kotlin and see it has operations for converting pointers to String’s, but it looks like these methods copy the underlying memory. I need a way to convert pointers to Strings without copying the underlying memory. Is this possible?