Interface Download.DecideDestinationCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
Download
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Download.DecideDestinationCallback extends FunctionPointer

Functional interface declaration of the DecideDestinationCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    run(String suggestedFilename)
    This signal is emitted after response is received to decide a destination for the download using webkit_download_set_destination().
    Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
    default int
    upcall(MemorySegment sourceDownload, MemorySegment suggestedFilename)
    The upcall method is called from native code.
  • Method Details

    • run

      boolean run(String suggestedFilename)

      This signal is emitted after response is received to decide a destination for the download using webkit_download_set_destination(). If this signal is not handled, the file will be downloaded to UserDirectory.DIRECTORY_DOWNLOAD directory using suggestedFilename.

      Since 2.40, you may handle this signal asynchronously by returning true without calling webkit_download_set_destination(). This indicates intent to eventually call webkit_download_set_destination(). In this case, the download will not proceed until the destination is set or cancelled with webkit_download_cancel().

    • upcall

      default int upcall(MemorySegment sourceDownload, MemorySegment suggestedFilename)
      The upcall method is called from native code. The parameters are marshaled and run(String) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer