Module notzed.zcl
Package api

Class Native

java.lang.Object
api.Native
Direct Known Subclasses:
Callback, CLObject

public class Native
extends java.lang.Object
Base class for all native objects. Handles instantiation and provides helper functions for native access. Work in progress. For better safety the 'p' field should be the CHandle, and addr() would call get(). Otherwise one must not release ANY object which might ever be used again - including any objects returned by the getInfo(). However ... it's a trade-off and it's a lot of code to change.
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected Native​(jdk.incubator.foreign.MemoryAddress p)  
  • Method Summary

    Modifier and Type Method Description
    jdk.incubator.foreign.MemoryAddress addr()  
    static jdk.incubator.foreign.MemoryAddress addr​(Native o)  
    static jdk.incubator.foreign.MemoryAddress addr​(jdk.incubator.foreign.MemorySegment o)  
    static void debugDumpReachable​(java.lang.String title)  
    static void debugFlushAll()  
    static java.lang.invoke.MethodHandle downcallHandle​(jdk.incubator.foreign.LibraryLookup[] libs, java.lang.String name, java.lang.String signature)  
    static java.lang.invoke.MethodHandle downcallHandle​(jdk.incubator.foreign.MemoryAddress addr, java.lang.String signature)  
    static void dumpSignature​(java.lang.String signature)  
    static void freeUpcallStub​(jdk.incubator.foreign.MemoryAddress addr)  
    static jdk.incubator.foreign.MemoryAddress getAddr​(jdk.incubator.foreign.MemoryAddress p)  
    static jdk.incubator.foreign.MemoryAddress getAddr​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static byte getByte​(jdk.incubator.foreign.MemoryAddress p)  
    static byte getByte​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static double getDouble​(jdk.incubator.foreign.MemoryAddress p)  
    static double getDouble​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static float getFloat​(jdk.incubator.foreign.MemoryAddress p)  
    static float getFloat​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static int getInt​(jdk.incubator.foreign.MemoryAddress p)  
    static int getInt​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static long getLong​(jdk.incubator.foreign.MemoryAddress p)  
    static long getLong​(jdk.incubator.foreign.MemoryAddress p, long i)  
    static short getShort​(jdk.incubator.foreign.MemoryAddress p)  
    static jdk.incubator.foreign.LibraryLookup[] loadLibraries​(java.lang.String... libraries)  
    static jdk.incubator.foreign.MemoryLayout parseStruct​(java.lang.String layout)  
    static jdk.incubator.foreign.MemoryLayout parseUnion​(java.lang.String layout)  
    void release()  
    static void release​(Native... list)  
    static <T extends Native>
    void
    release​(T a)  
    static <T extends Native>
    T
    resolve​(jdk.incubator.foreign.MemoryAddress p, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create)  
    static void setAddr​(jdk.incubator.foreign.MemoryAddress p, long i, jdk.incubator.foreign.MemoryAddress v)  
    static void setAddr​(jdk.incubator.foreign.MemoryAddress p, jdk.incubator.foreign.MemoryAddress v)  
    static void setByte​(jdk.incubator.foreign.MemoryAddress p, byte v)  
    static void setByte​(jdk.incubator.foreign.MemoryAddress p, long i, byte v)  
    static void setDouble​(jdk.incubator.foreign.MemoryAddress p, double v)  
    static void setDouble​(jdk.incubator.foreign.MemoryAddress p, long i, double v)  
    static void setFloat​(jdk.incubator.foreign.MemoryAddress p, float v)  
    static void setFloat​(jdk.incubator.foreign.MemoryAddress p, long i, float v)  
    static void setInt​(jdk.incubator.foreign.MemoryAddress p, int v)  
    static void setInt​(jdk.incubator.foreign.MemoryAddress p, long i, int v)  
    static void setLong​(jdk.incubator.foreign.MemoryAddress p, long v)  
    static void setLong​(jdk.incubator.foreign.MemoryAddress p, long i, long v)  
    static void setShort​(jdk.incubator.foreign.MemoryAddress p, long i, short v)  
    static void setShort​(jdk.incubator.foreign.MemoryAddress p, short v)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toAddrV​(Allocator frame, java.lang.String[] array)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toAddrV​(Allocator frame, T[] array)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toAddrV​(Allocator frame, T[] array, int len)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toByteV​(Allocator frame, byte[] data)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toByteV​(Allocator frame, java.lang.String string)  
    static <T extends Native>
    jdk.incubator.foreign.MemoryAddress
    toLongV​(Allocator frame, long[] array)  
    static long[] toLongV​(jdk.incubator.foreign.MemorySegment valp)  
    static <T extends Native>
    T[]
    toObjectV​(jdk.incubator.foreign.MemoryAddress list, T[] array, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create)  
    static <T extends Native>
    T[]
    toObjectV​(jdk.incubator.foreign.MemorySegment list, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create, java.util.function.IntFunction<T[]> createArray)  
    static java.lang.String toString​(jdk.incubator.foreign.MemoryAddress cstr)  
    static jdk.incubator.foreign.MemoryAddress upcallStub​(java.lang.invoke.MethodHandles.Lookup lookup, java.lang.Object instance, java.lang.String signature)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Native

      protected Native​(jdk.incubator.foreign.MemoryAddress p)
  • Method Details

    • addr

      public jdk.incubator.foreign.MemoryAddress addr()
    • addr

      public static jdk.incubator.foreign.MemoryAddress addr​(Native o)
    • addr

      public static jdk.incubator.foreign.MemoryAddress addr​(jdk.incubator.foreign.MemorySegment o)
    • getByte

      public static byte getByte​(jdk.incubator.foreign.MemoryAddress p)
    • getByte

      public static byte getByte​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setByte

      public static void setByte​(jdk.incubator.foreign.MemoryAddress p, byte v)
    • setByte

      public static void setByte​(jdk.incubator.foreign.MemoryAddress p, long i, byte v)
    • getInt

      public static int getInt​(jdk.incubator.foreign.MemoryAddress p)
    • getInt

      public static int getInt​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setInt

      public static void setInt​(jdk.incubator.foreign.MemoryAddress p, int v)
    • setInt

      public static void setInt​(jdk.incubator.foreign.MemoryAddress p, long i, int v)
    • getShort

      public static short getShort​(jdk.incubator.foreign.MemoryAddress p)
    • setShort

      public static void setShort​(jdk.incubator.foreign.MemoryAddress p, short v)
    • setShort

      public static void setShort​(jdk.incubator.foreign.MemoryAddress p, long i, short v)
    • getLong

      public static long getLong​(jdk.incubator.foreign.MemoryAddress p)
    • getLong

      public static long getLong​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setLong

      public static void setLong​(jdk.incubator.foreign.MemoryAddress p, long v)
    • setLong

      public static void setLong​(jdk.incubator.foreign.MemoryAddress p, long i, long v)
    • getFloat

      public static float getFloat​(jdk.incubator.foreign.MemoryAddress p)
    • getFloat

      public static float getFloat​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setFloat

      public static void setFloat​(jdk.incubator.foreign.MemoryAddress p, float v)
    • setFloat

      public static void setFloat​(jdk.incubator.foreign.MemoryAddress p, long i, float v)
    • getDouble

      public static double getDouble​(jdk.incubator.foreign.MemoryAddress p)
    • getDouble

      public static double getDouble​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setDouble

      public static void setDouble​(jdk.incubator.foreign.MemoryAddress p, double v)
    • setDouble

      public static void setDouble​(jdk.incubator.foreign.MemoryAddress p, long i, double v)
    • getAddr

      public static jdk.incubator.foreign.MemoryAddress getAddr​(jdk.incubator.foreign.MemoryAddress p)
    • getAddr

      public static jdk.incubator.foreign.MemoryAddress getAddr​(jdk.incubator.foreign.MemoryAddress p, long i)
    • setAddr

      public static void setAddr​(jdk.incubator.foreign.MemoryAddress p, jdk.incubator.foreign.MemoryAddress v)
    • setAddr

      public static void setAddr​(jdk.incubator.foreign.MemoryAddress p, long i, jdk.incubator.foreign.MemoryAddress v)
    • toAddrV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toAddrV​(Allocator frame, T[] array, int len)
    • toAddrV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toAddrV​(Allocator frame, T[] array)
    • toAddrV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toAddrV​(Allocator frame, java.lang.String[] array)
    • toLongV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toLongV​(Allocator frame, long[] array)
    • toByteV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toByteV​(Allocator frame, byte[] data)
    • toByteV

      public static <T extends Native> jdk.incubator.foreign.MemoryAddress toByteV​(Allocator frame, java.lang.String string)
    • toObjectV

      public static <T extends Native> T[] toObjectV​(jdk.incubator.foreign.MemoryAddress list, T[] array, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create)
    • toObjectV

      public static <T extends Native> T[] toObjectV​(jdk.incubator.foreign.MemorySegment list, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create, java.util.function.IntFunction<T[]> createArray)
    • toString

      public static java.lang.String toString​(jdk.incubator.foreign.MemoryAddress cstr)
    • toLongV

      public static long[] toLongV​(jdk.incubator.foreign.MemorySegment valp)
    • downcallHandle

      public static java.lang.invoke.MethodHandle downcallHandle​(jdk.incubator.foreign.LibraryLookup[] libs, java.lang.String name, java.lang.String signature)
    • downcallHandle

      public static java.lang.invoke.MethodHandle downcallHandle​(jdk.incubator.foreign.MemoryAddress addr, java.lang.String signature)
    • upcallStub

      public static jdk.incubator.foreign.MemoryAddress upcallStub​(java.lang.invoke.MethodHandles.Lookup lookup, java.lang.Object instance, java.lang.String signature)
    • freeUpcallStub

      public static void freeUpcallStub​(jdk.incubator.foreign.MemoryAddress addr)
    • loadLibraries

      public static jdk.incubator.foreign.LibraryLookup[] loadLibraries​(java.lang.String... libraries)
    • parseStruct

      public static jdk.incubator.foreign.MemoryLayout parseStruct​(java.lang.String layout)
    • parseUnion

      public static jdk.incubator.foreign.MemoryLayout parseUnion​(java.lang.String layout)
    • dumpSignature

      public static void dumpSignature​(java.lang.String signature)
    • resolve

      public static <T extends Native> T resolve​(jdk.incubator.foreign.MemoryAddress p, java.util.function.Function<jdk.incubator.foreign.MemoryAddress,​T> create)
    • release

      public void release()
    • release

      public static <T extends Native> void release​(T a)
    • release

      public static void release​(Native... list)
    • debugFlushAll

      public static void debugFlushAll()
    • debugDumpReachable

      public static void debugDumpReachable​(java.lang.String title)