Class Vfs

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Vfs extends GObject
Entry point for using GIO functionality.
  • Constructor Details

    • Vfs

      public Vfs(MemorySegment address)
      Create a Vfs instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Vfs

      public Vfs()
      Create a new Vfs.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Vfs class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected Vfs asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getDefault

      public static Vfs getDefault()
      Gets the default GVfs for the system.
      Returns:
      a GVfs, which will be the local file system GVfs if no other implementation is available.
    • getLocal

      public static Vfs getLocal()
      Gets the local GVfs for the system.
      Returns:
      a GVfs.
    • getFileForPath

      public File getFileForPath(String path)
      Gets a GFile for path.
      Parameters:
      path - a string containing a VFS path.
      Returns:
      a GFile. Free the returned object with g_object_unref().
    • getFileForUri

      public File getFileForUri(String uri)

      Gets a GFile for uri.

      This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

      Parameters:
      uri - a string containing a URI
      Returns:
      a GFile. Free the returned object with g_object_unref().
    • getSupportedUriSchemes

      public String[] getSupportedUriSchemes()
      Gets a list of URI schemes supported by vfs.
      Returns:
      a null-terminated array of strings. The returned array belongs to GIO and must not be freed or modified.
    • isActive

      public boolean isActive()
      Checks if the VFS is active.
      Returns:
      true if construction of the this Vfs was successful and it is now active.
    • parseName

      public File parseName(String parseName)
      This operation never fails, but the returned object might not support any I/O operations if the parseName cannot be parsed by the GVfs module.
      Parameters:
      parseName - a string to be parsed by the VFS module.
      Returns:
      a GFile for the given parseName. Free the returned object with g_object_unref().
    • registerUriScheme

      public boolean registerUriScheme(String scheme, @Nullable VfsFileLookupFunc uriFunc, @Nullable VfsFileLookupFunc parseNameFunc)

      Registers uriFunc and parseNameFunc as the GFile URI and parse name lookup functions for URIs with a scheme matching scheme. Note that scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.

      When a GFile is requested with an URI containing scheme (e.g. through g_file_new_for_uri()), uriFunc will be called to allow a custom constructor. The implementation of uriFunc should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().

      When g_file_parse_name() is called with a parse name obtained from such file, parseNameFunc will be called to allow the GFile to be created again. In that case, it's responsibility of parseNameFunc to make sure the parse name matches what the custom GFile implementation returned when g_file_get_parse_name() was previously called. The implementation of parseNameFunc should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().

      It's an error to call this function twice with the same scheme. To unregister a custom URI scheme, use g_vfs_unregister_uri_scheme().

      Parameters:
      scheme - an URI scheme, e.g. "http"
      uriFunc - a GVfsFileLookupFunc
      parseNameFunc - a GVfsFileLookupFunc
      Returns:
      true if scheme was successfully registered, or false if a handler for scheme already exists.
      Since:
      2.50
    • unregisterUriScheme

      public boolean unregisterUriScheme(String scheme)
      Unregisters the URI handler for scheme previously registered with g_vfs_register_uri_scheme().
      Parameters:
      scheme - an URI scheme, e.g. "http"
      Returns:
      true if scheme was successfully unregistered, or false if a handler for scheme does not exist.
      Since:
      2.50
    • addWritableNamespaces

      protected void addWritableNamespaces(FileAttributeInfoList list)
    • deserializeIcon

      protected Icon deserializeIcon(Variant value)
    • localFileAddInfo

      protected void localFileAddInfo(String filename, long device, FileAttributeMatcher attributeMatcher, FileInfo info, @Nullable Cancellable cancellable, @Nullable MemorySegment extraData)
    • localFileMoved

      protected void localFileMoved(String source, String dest)
    • localFileRemoved

      protected void localFileRemoved(String filename)
    • localFileSetAttributes

      protected boolean localFileSetAttributes(String filename, FileInfo info, Set<FileQueryInfoFlags> flags, @Nullable Cancellable cancellable) throws GErrorException
      Throws:
      GErrorException
    • builder

      public static Vfs.Builder<? extends Vfs.Builder> builder()
      A Vfs.Builder object constructs a Vfs with the specified properties. Use the various set...() methods to set properties, and finish construction with Vfs.Builder.build().
      Returns:
      the builder object