Class FfmDaveFactory

java.lang.Object
moe.kyokobot.libdave.FfmDaveFactory
All Implemented Interfaces:
moe.kyokobot.libdave.DaveFactory
Direct Known Subclasses:
FfmNettyDaveFactory

public class FfmDaveFactory extends Object implements moe.kyokobot.libdave.DaveFactory
DaveFactory backed by the Java Foreign Function & Memory API (Java 22+).

The JVM must be allowed to call native code, e.g. with --enable-native-access=ALL-UNNAMED.

  • Constructor Details

    • FfmDaveFactory

      public FfmDaveFactory()
      Creates a new factory. The native library is loaded on first use.
  • Method Details

    • ensureAvailable

      public static void ensureAvailable() throws RuntimeException
      Loads the native library and ensures that FfmDaveFactory can be used on this platform.
      Throws:
      RuntimeException - if the native library could not be loaded and the factory is not safe to use.
    • setLogSink

      public static void setLogSink(@Nullable @Nullable moe.kyokobot.libdave.callbacks.DaveLogSink sink)
      Sets a log sink for native code. This is optional and can be used to receive log messages from the native library.
      Parameters:
      sink - an instance of DaveLogSink to receive log messages, or null to disable logging (default).
    • maxSupportedProtocolVersion

      public int maxSupportedProtocolVersion()
      Specified by:
      maxSupportedProtocolVersion in interface moe.kyokobot.libdave.DaveFactory
    • createDecryptor

      public moe.kyokobot.libdave.Decryptor createDecryptor()
      Specified by:
      createDecryptor in interface moe.kyokobot.libdave.DaveFactory
    • createEncryptor

      public moe.kyokobot.libdave.Encryptor createEncryptor()
      Specified by:
      createEncryptor in interface moe.kyokobot.libdave.DaveFactory
    • createSession

      public moe.kyokobot.libdave.Session createSession(String context, String authSessionId, moe.kyokobot.libdave.callbacks.MLSFailureCallback callback)
      Specified by:
      createSession in interface moe.kyokobot.libdave.DaveFactory