CStringMapper

public class CStringMapper implements Mapper

Mapper for C strings.

Fields

string2addr

public Map<String, Pointer> string2addr

Collection used for caching generated native C strings.

Because this is a weak has map, the C strings will be released after every Java reference to them is gone.

Methods

toJava

public Object toJava(long peer, JavaObjectConstructionInfo info)

Creates a Java string.

Creates a Java string from a C string.

toNative

public long toNative(Object instance, NativeObjectConstructionInfo info)

Creates a C string.

At first it lookups in the cache, if it results in a success, then it uses it as a result. Otherwise, it creates a C string and cache it in {link #string2addr} and returns it.