Package org.gnome.gio

Class FileInfo

java.lang.Object
All Implemented Interfaces:
Proxy

@Generated("io.github.jwharm.JavaGI") public class FileInfo extends GObject
Stores information about a file system object referenced by a File.

Functionality for manipulating basic metadata for files. GFileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See the file attributes document for more information on how GIO handles file attributes.

To obtain a GFileInfo for a File, use File.queryInfo(java.lang.String, java.util.Set<org.gnome.gio.FileQueryInfoFlags>, org.gnome.gio.Cancellable) (or its async variant). To obtain a GFileInfo for a file input or output stream, use FileInputStream.queryInfo(java.lang.String, org.gnome.gio.Cancellable) or FileOutputStream.queryInfo(java.lang.String, org.gnome.gio.Cancellable) (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the GFileInfo and call File.setAttributesFromInfo(org.gnome.gio.FileInfo, java.util.Set<org.gnome.gio.FileQueryInfoFlags>, org.gnome.gio.Cancellable) or File.setAttributesAsync(org.gnome.gio.FileInfo, java.util.Set<org.gnome.gio.FileQueryInfoFlags>, int, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) on a GFile.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via setSize(long). You may call File.querySettableAttributes(org.gnome.gio.Cancellable) and File.queryWritableNamespaces(org.gnome.gio.Cancellable) to discover the settable attributes of a particular file at runtime.

The direct accessors, such as getName(), are slightly more optimized than the generic attribute accessors, such as getAttributeByteString(java.lang.String).This optimization will matter only if calling the API in a tight loop.

It is an error to call these accessors without specifying their required file attributes when creating the GFileInfo. Use hasAttribute(java.lang.String) or listAttributes(java.lang.String) to check what attributes are specified for a GFileInfo.

Gio.FileAttributeMatcher allows for searching through a GFileInfo for attributes.