Interface FileMeasureProgressCallback

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

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface FileMeasureProgressCallback extends FunctionPointer

Functional interface declaration of the FileMeasureProgressCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(boolean reporting, long currentSize, long numDirs, long numFiles, @Nullable MemorySegment data)
    This callback type is used by g_file_measure_disk_usage() to make periodic progress reports when measuring the amount of disk spaced used by a directory.
    Creates a native function pointer to the upcall(int, long, long, long, MemorySegment) method.
    default void
    upcall(int reporting, long currentSize, long numDirs, long numFiles, MemorySegment data)
    The upcall method is called from native code.
  • Method Details

    • run

      void run(boolean reporting, long currentSize, long numDirs, long numFiles, @Nullable MemorySegment data)

      This callback type is used by g_file_measure_disk_usage() to make periodic progress reports when measuring the amount of disk spaced used by a directory.

      These calls are made on a best-effort basis and not all types of GFile will support them. At the minimum, however, one call will always be made immediately.

      In the case that there is no support, reporting will be set to false (and the other values undefined) and no further calls will be made. Otherwise, the reporting will be true and the other values all-zeros during the first (immediate) call. In this way, you can know which type of progress UI to show without a delay.

      For g_file_measure_disk_usage() the callback is made directly. For g_file_measure_disk_usage_async() the callback is made via the default main context of the calling thread (ie: the same way that the final async result would be reported).

      currentSize is in the same units as requested by the operation (see FileMeasureFlags.APPARENT_SIZE).

      The frequency of the updates is implementation defined, but is ideally about once every 200ms.

      The last progress callback may or may not be equal to the final result. Always check the async result to get the final value.

      Parameters:
      reporting - true if more reports will come
      currentSize - the current cumulative size measurement
      numDirs - the number of directories visited so far
      numFiles - the number of non-directory files encountered
      data - the data passed to the original request for this callback
      Since:
      2.38
    • upcall

      default void upcall(int reporting, long currentSize, long numDirs, long numFiles, MemorySegment data)
      The upcall method is called from native code. The parameters are marshaled and run(boolean, long, long, long, MemorySegment) is executed.
    • toCallback

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