Class FileInfo
- All Implemented Interfaces:
Proxy
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFileInfo.Builder<B extends FileInfo.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionFileInfo()Creates a new FileInfo.FileInfo(MemorySegment address) Create a FileInfo proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileInfoasParent()Returns this instance as if it were its parent type.static FileInfo.Builder<? extends FileInfo.Builder> builder()AFileInfo.Builderobject constructs aFileInfowith the specified properties.voidClears the status information frominfo.voidFirst clears all of the GFileAttribute ofdestInfo,and then copies all of the file attributes from this FileInfo todestInfo.dup()Duplicates a file info structure.@Nullable DateTimeGets the access time of the current this FileInfo and returns it as aGDateTime.@Nullable StringgetAttributeAsString(String attribute) Gets the value of an attribute, formatted as a human readable string.booleangetAttributeBoolean(String attribute) Gets the value of a boolean attribute.@Nullable StringgetAttributeByteString(String attribute) Gets the value of a byte string attribute.booleangetAttributeData(String attribute, @Nullable Out<FileAttributeType> type, @Nullable Out<MemorySegment> valuePp, @Nullable Out<FileAttributeStatus> status) Gets the attribute type, value and status for an attribute key.@Nullable StringgetAttributeFilePath(String attribute) Gets the value of a byte string attribute as a file path.intgetAttributeInt32(String attribute) Gets a signed 32-bit integer contained within the attribute.longgetAttributeInt64(String attribute) Gets a signed 64-bit integer contained within the attribute.@Nullable GObjectgetAttributeObject(String attribute) Gets the value of aGObjectattribute.getAttributeStatus(String attribute) Gets the attribute status for an attribute key.@Nullable StringgetAttributeString(String attribute) Gets the value of a string attribute.@Nullable String @Nullable []getAttributeStringv(String attribute) Gets the value of a stringv attribute.getAttributeType(String attribute) Gets the attribute type for an attribute key.intgetAttributeUint32(String attribute) Gets an unsigned 32-bit integer contained within the attribute.longgetAttributeUint64(String attribute) Gets a unsigned 64-bit integer contained within the attribute.@Nullable StringGets the file's content type.@Nullable DateTimeGets the creation time of the current this FileInfo and returns it as aGDateTime.@Nullable DateTimeReturns theGDateTimerepresenting the deletion date of the file, as available inG_FILE_ATTRIBUTE_TRASH_DELETION_DATE.Gets a display name for a file.Gets the edit name for a file.@Nullable StringgetEtag()Gets theGio.File#entity-tagsfor a givenGFileInfo.Gets a file's type (whether it is a regular file, symlink, etc).@Nullable IcongetIcon()Gets the icon for a file.booleanChecks if a file is a backup file.booleanChecks if a file is hidden.booleanChecks if a file is a symlink.@Nullable DateTimeGets the modification time of the current this FileInfo and returns it as aGDateTime.voidgetModificationTime(TimeVal result) Deprecated.getName()Gets the name for a file.longgetSize()Gets the file's size (in bytes).intGets the value of the sort_order attribute from theGFileInfo.@Nullable IconGets the symbolic icon for a file.@Nullable StringGets the symlink target for a givenGFileInfo.static @Nullable TypegetType()Get the GType of the FileInfo classbooleanhasAttribute(String attribute) Checks if a file info structure has an attribute namedattribute.booleanhasNamespace(String nameSpace) Checks if a file info structure has an attribute in the specifiednameSpace.@Nullable String @Nullable []listAttributes(@Nullable String nameSpace) Lists the file info structure's attributes.voidremoveAttribute(String attribute) Removes all cases ofattributefrom this FileInfo if it exists.voidsetAccessDateTime(DateTime atime) Sets theG_FILE_ATTRIBUTE_TIME_ACCESSandG_FILE_ATTRIBUTE_TIME_ACCESS_USECattributes in the file info to the given date/time value.voidsetAttribute(String attribute, FileAttributeType type, MemorySegment valueP) Sets theattributeto contain the given value, if possible.voidsetAttributeBoolean(String attribute, boolean attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeByteString(String attribute, String attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeFilePath(String attribute, String attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeInt32(String attribute, int attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeInt64(String attribute, long attrValue) Sets theattributeto contain the givenattrValue,if possible.voidSetsmaskon this FileInfo to match specific attribute types.voidsetAttributeObject(String attribute, GObject attrValue) Sets theattributeto contain the givenattrValue,if possible.booleansetAttributeStatus(String attribute, FileAttributeStatus status) Sets the attribute status for an attribute key.voidsetAttributeString(String attribute, String attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeStringv(String attribute, @Nullable String @Nullable [] attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeUint32(String attribute, int attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetAttributeUint64(String attribute, long attrValue) Sets theattributeto contain the givenattrValue,if possible.voidsetContentType(String contentType) Sets the content type attribute for a givenGFileInfo.voidsetCreationDateTime(DateTime creationTime) Sets theG_FILE_ATTRIBUTE_TIME_CREATEDandG_FILE_ATTRIBUTE_TIME_CREATED_USECattributes in the file info to the given date/time value.voidsetDisplayName(String displayName) Sets the display name for the currentGFileInfo.voidsetEditName(String editName) Sets the edit name for the current file.voidsetFileType(FileType type) Sets the file type in aGFileInfototype.SeeG_FILE_ATTRIBUTE_STANDARD_TYPE.voidSets the icon for a givenGFileInfo.voidsetIsHidden(boolean isHidden) Sets the "is_hidden" attribute in aGFileInfoaccording toisHidden.SeeG_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.voidsetIsSymlink(boolean isSymlink) Sets the "is_symlink" attribute in aGFileInfoaccording toisSymlink.SeeG_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.voidsetModificationDateTime(DateTime mtime) Sets theG_FILE_ATTRIBUTE_TIME_MODIFIEDandG_FILE_ATTRIBUTE_TIME_MODIFIED_USECattributes in the file info to the given date/time value.voidsetModificationTime(TimeVal mtime) Deprecated.Use g_file_info_set_modification_date_time() instead, asGTimeValis deprecated due to the year 2038 problem.voidSets the name attribute for the currentGFileInfo.voidsetSize(long size) Sets theG_FILE_ATTRIBUTE_STANDARD_SIZEattribute in the file info to the given size.voidsetSortOrder(int sortOrder) Sets the sort order attribute in the file info structure.voidsetSymbolicIcon(Icon icon) Sets the symbolic icon for a givenGFileInfo.voidsetSymlinkTarget(String symlinkTarget) Sets theG_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGETattribute in the file info to the given symlink target.voidUnsets a mask set by g_file_info_set_attribute_mask(), if one is set.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
FileInfo
Create a FileInfo proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
FileInfo
public FileInfo()Creates a new FileInfo.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
clearStatus
public void clearStatus()Clears the status information frominfo. -
copyInto
First clears all of the GFileAttribute ofdestInfo,and then copies all of the file attributes from this FileInfo todestInfo.- Parameters:
destInfo- destination to copy attributes to.
-
dup
-
getAccessDateTime
Gets the access time of the current this FileInfo and returns it as aGDateTime.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_TIME_ACCESS. IfG_FILE_ATTRIBUTE_TIME_ACCESS_USECis provided, the resultingGDateTimewill additionally have microsecond precision.If nanosecond precision is needed,
G_FILE_ATTRIBUTE_TIME_ACCESS_NSECmust be queried separately using g_file_info_get_attribute_uint32().- Returns:
- access time, or
nullif unknown - Since:
- 2.70
-
getAttributeAsString
Gets the value of an attribute, formatted as a human readable string.This escapes things as needed to make the string valid UTF-8 and readable by humans. It’s not meant to be a machine readable or reversible escaping format.
To format file name attributes of type
Gio.FileAttributeType.BYTE_STRINGfor output as UTF-8, useGLib.filenameToUtf8(java.lang.String, long, org.javagi.base.Out<java.lang.Long>, org.javagi.base.Out<java.lang.Long>)instead:const char *trash_orig_path_byte_string; g_autofree char *trash_orig_path_utf8 = NULL; trash_orig_path_byte_string = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH); trash_orig_path_utf8 = g_filename_to_utf8 (trash_orig_path_byte_string, -1, NULL, NULL, NULL); if (trash_orig_path_utf8 != NULL) g_message ("Some larger UTF-8 string with filename embedded as %s", trash_orig_path_utf8);- Parameters:
attribute- a file attribute key.- Returns:
- a UTF-8 string associated with the given
attribute,ornullif the attribute wasn’t set. When you're done with the string it must be freed with g_free().
-
getAttributeBoolean
Gets the value of a boolean attribute. If the attribute does not contain a boolean value,falsewill be returned.- Parameters:
attribute- a file attribute key.- Returns:
- the boolean value contained within the attribute.
-
getAttributeByteString
Gets the value of a byte string attribute. If the attribute does not contain a byte string,nullwill be returned.- Parameters:
attribute- a file attribute key.- Returns:
- the contents of the
attributevalue as a byte string, ornullotherwise.
-
getAttributeData
public boolean getAttributeData(String attribute, @Nullable Out<FileAttributeType> type, @Nullable Out<MemorySegment> valuePp, @Nullable Out<FileAttributeStatus> status) Gets the attribute type, value and status for an attribute key.- Parameters:
attribute- a file attribute keytype- return location for the attribute type, ornullvaluePp- return location for the attribute value, ornull; the attribute value will not benullstatus- return location for the attribute status, ornull- Returns:
trueif this FileInfo has an attribute namedattribute,falseotherwise.
-
getAttributeFilePath
Gets the value of a byte string attribute as a file path.If the attribute does not contain a byte string,
NULLwill be returned.This function is meant to be used by language bindings that have specific handling for Unix paths.
- Parameters:
attribute- a file attribute key.- Returns:
- the contents of the
attributevalue as a file path, ornullotherwise. - Since:
- 2.78
-
getAttributeInt32
Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.- Parameters:
attribute- a file attribute key.- Returns:
- a signed 32-bit integer from the attribute.
-
getAttributeInt64
Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned.- Parameters:
attribute- a file attribute key.- Returns:
- a signed 64-bit integer from the attribute.
-
getAttributeObject
-
getAttributeStatus
Gets the attribute status for an attribute key.- Parameters:
attribute- a file attribute key- Returns:
- a
GFileAttributeStatusfor the givenattribute,orFileAttributeStatus.UNSETif the key is invalid.
-
getAttributeString
-
getAttributeStringv
Gets the value of a stringv attribute. If the attribute does not contain a stringv,nullwill be returned.- Parameters:
attribute- a file attribute key.- Returns:
- the contents of the
attributevalue as a stringv, ornullotherwise. Do not free. These returned strings are UTF-8. - Since:
- 2.22
-
getAttributeType
Gets the attribute type for an attribute key.- Parameters:
attribute- a file attribute key.- Returns:
- a
GFileAttributeTypefor the givenattribute,orFileAttributeType.INVALIDif the key is not set.
-
getAttributeUint32
Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.- Parameters:
attribute- a file attribute key.- Returns:
- an unsigned 32-bit integer from the attribute.
-
getAttributeUint64
Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.- Parameters:
attribute- a file attribute key.- Returns:
- a unsigned 64-bit integer from the attribute.
-
getContentType
Gets the file's content type.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.- Returns:
- a string containing the file's content type,
or
nullif unknown.
-
getCreationDateTime
Gets the creation time of the current this FileInfo and returns it as aGDateTime.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_TIME_CREATED. IfG_FILE_ATTRIBUTE_TIME_CREATED_USECis provided, the resultingGDateTimewill additionally have microsecond precision.If nanosecond precision is needed,
G_FILE_ATTRIBUTE_TIME_CREATED_NSECmust be queried separately using g_file_info_get_attribute_uint32().- Returns:
- creation time, or
nullif unknown - Since:
- 2.70
-
getDeletionDate
Returns theGDateTimerepresenting the deletion date of the file, as available inG_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If theG_FILE_ATTRIBUTE_TRASH_DELETION_DATEattribute is unset,nullis returned.- Returns:
- a
GDateTime, ornull. - Since:
- 2.36
-
getDisplayName
Gets a display name for a file. This is guaranteed to always be set.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.- Returns:
- a string containing the display name.
-
getEditName
Gets the edit name for a file.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.- Returns:
- a string containing the edit name.
-
getEtag
Gets theGio.File#entity-tagsfor a givenGFileInfo. SeeG_FILE_ATTRIBUTE_ETAG_VALUE.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_ETAG_VALUE.- Returns:
- a string containing the value of the "etag:value" attribute.
-
getFileType
Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see g_file_info_get_content_type().It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_TYPE.- Returns:
- a
GFileTypefor the given file.
-
getIcon
Gets the icon for a file.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_ICON.- Returns:
GIconfor the giveninfo.
-
getIsBackup
public boolean getIsBackup()Checks if a file is a backup file.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_IS_BACKUP.- Returns:
trueif file is a backup file,falseotherwise.
-
getIsHidden
public boolean getIsHidden()Checks if a file is hidden.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.- Returns:
trueif the file is a hidden file,falseotherwise.
-
getIsSymlink
public boolean getIsSymlink()Checks if a file is a symlink.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.- Returns:
trueif the given this FileInfo is a symlink.
-
getModificationDateTime
Gets the modification time of the current this FileInfo and returns it as aGDateTime.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_TIME_MODIFIED. IfG_FILE_ATTRIBUTE_TIME_MODIFIED_USECis provided, the resultingGDateTimewill additionally have microsecond precision.If nanosecond precision is needed,
G_FILE_ATTRIBUTE_TIME_MODIFIED_NSECmust be queried separately using g_file_info_get_attribute_uint32().- Returns:
- modification time, or
nullif unknown - Since:
- 2.62
-
getModificationTime
Deprecated.Use g_file_info_get_modification_date_time() instead, asGTimeValis deprecated due to the year 2038 problem.Gets the modification time of the current this FileInfo and sets it inresult.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_TIME_MODIFIED. IfG_FILE_ATTRIBUTE_TIME_MODIFIED_USECis provided it will be used too.- Parameters:
result- aGTimeVal.
-
getName
Gets the name for a file. This is guaranteed to always be set.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_NAME.- Returns:
- a string containing the file name.
-
getSize
public long getSize()Gets the file's size (in bytes). The size is retrieved through the value of theG_FILE_ATTRIBUTE_STANDARD_SIZEattribute and is converted fromguint64togoffsetbefore returning the result.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_SIZE.- Returns:
- a
goffsetcontaining the file's size (in bytes).
-
getSortOrder
public int getSortOrder()Gets the value of the sort_order attribute from theGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.- Returns:
- a
gint32containing the value of the "standard::sort_order" attribute.
-
getSymbolicIcon
Gets the symbolic icon for a file.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.- Returns:
GIconfor the giveninfo.- Since:
- 2.34
-
getSymlinkTarget
Gets the symlink target for a givenGFileInfo.It is an error to call this if the
GFileInfodoes not containG_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET.- Returns:
- a string containing the symlink target.
-
hasAttribute
Checks if a file info structure has an attribute namedattribute.- Parameters:
attribute- a file attribute key.- Returns:
trueif this FileInfo has an attribute namedattribute,falseotherwise.
-
hasNamespace
Checks if a file info structure has an attribute in the specifiednameSpace.- Parameters:
nameSpace- a file attribute namespace.- Returns:
trueif this FileInfo has an attribute innameSpace,falseotherwise.- Since:
- 2.22
-
listAttributes
Lists the file info structure's attributes.- Parameters:
nameSpace- a file attribute key's namespace, ornullto list all attributes.- Returns:
- a
null-terminated array of strings of all of the possible attribute
types for the given
nameSpace,ornullon error.
-
removeAttribute
Removes all cases ofattributefrom this FileInfo if it exists.- Parameters:
attribute- a file attribute key.
-
setAccessDateTime
Sets theG_FILE_ATTRIBUTE_TIME_ACCESSandG_FILE_ATTRIBUTE_TIME_ACCESS_USECattributes in the file info to the given date/time value.G_FILE_ATTRIBUTE_TIME_ACCESS_NSECwill be cleared.- Parameters:
atime- aGDateTime.- Since:
- 2.70
-
setAttribute
Sets theattributeto contain the given value, if possible. To unset the attribute, useFileAttributeType.INVALIDfortype.- Parameters:
attribute- a file attribute key.type- aGFileAttributeTypevalueP- pointer to the value
-
setAttributeBoolean
Sets theattributeto contain the givenattrValue,if possible.- Parameters:
attribute- a file attribute key.attrValue- a boolean value.
-
setAttributeByteString
-
setAttributeFilePath
Sets theattributeto contain the givenattrValue,if possible.This function is meant to be used by language bindings that have specific handling for Unix paths.
- Parameters:
attribute- a file attribute key.attrValue- a file path.- Since:
- 2.78
-
setAttributeInt32
Sets theattributeto contain the givenattrValue,if possible.- Parameters:
attribute- a file attribute key.attrValue- a signed 32-bit integer
-
setAttributeInt64
Sets theattributeto contain the givenattrValue,if possible.- Parameters:
attribute- attribute name to set.attrValue- int64 value to set attribute to.
-
setAttributeMask
Setsmaskon this FileInfo to match specific attribute types.- Parameters:
mask- aGFileAttributeMatcher.
-
setAttributeObject
-
setAttributeStatus
Sets the attribute status for an attribute key. This is only needed by external code that implement g_file_set_attributes_from_info() or similar functions.The attribute must exist in this FileInfo for this to work. Otherwise
falseis returned and this FileInfo is unchanged.- Parameters:
attribute- a file attribute keystatus- aGFileAttributeStatus- Returns:
trueif the status was changed,falseif the key was not set.- Since:
- 2.22
-
setAttributeString
-
setAttributeStringv
-
setAttributeUint32
Sets theattributeto contain the givenattrValue,if possible.- Parameters:
attribute- a file attribute key.attrValue- an unsigned 32-bit integer.
-
setAttributeUint64
Sets theattributeto contain the givenattrValue,if possible.- Parameters:
attribute- a file attribute key.attrValue- an unsigned 64-bit integer.
-
setContentType
Sets the content type attribute for a givenGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.- Parameters:
contentType- a content type.
-
setCreationDateTime
Sets theG_FILE_ATTRIBUTE_TIME_CREATEDandG_FILE_ATTRIBUTE_TIME_CREATED_USECattributes in the file info to the given date/time value.G_FILE_ATTRIBUTE_TIME_CREATED_NSECwill be cleared.- Parameters:
creationTime- aGDateTime.- Since:
- 2.70
-
setDisplayName
Sets the display name for the currentGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.- Parameters:
displayName- a string containing a display name.
-
setEditName
Sets the edit name for the current file. SeeG_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.- Parameters:
editName- a string containing an edit name.
-
setFileType
Sets the file type in aGFileInfototype.SeeG_FILE_ATTRIBUTE_STANDARD_TYPE.- Parameters:
type- aGFileType.
-
setIcon
Sets the icon for a givenGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_ICON.- Parameters:
icon- aGIcon.
-
setIsHidden
public void setIsHidden(boolean isHidden) Sets the "is_hidden" attribute in aGFileInfoaccording toisHidden.SeeG_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.- Parameters:
isHidden- agboolean.
-
setIsSymlink
public void setIsSymlink(boolean isSymlink) Sets the "is_symlink" attribute in aGFileInfoaccording toisSymlink.SeeG_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.- Parameters:
isSymlink- agboolean.
-
setModificationDateTime
Sets theG_FILE_ATTRIBUTE_TIME_MODIFIEDandG_FILE_ATTRIBUTE_TIME_MODIFIED_USECattributes in the file info to the given date/time value.G_FILE_ATTRIBUTE_TIME_MODIFIED_NSECwill be cleared.- Parameters:
mtime- aGDateTime.- Since:
- 2.62
-
setModificationTime
Deprecated.Use g_file_info_set_modification_date_time() instead, asGTimeValis deprecated due to the year 2038 problem.Sets theG_FILE_ATTRIBUTE_TIME_MODIFIEDandG_FILE_ATTRIBUTE_TIME_MODIFIED_USECattributes in the file info to the given time value.G_FILE_ATTRIBUTE_TIME_MODIFIED_NSECwill be cleared.- Parameters:
mtime- aGTimeVal.
-
setName
Sets the name attribute for the currentGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_NAME.- Parameters:
name- a string containing a name.
-
setSize
public void setSize(long size) Sets theG_FILE_ATTRIBUTE_STANDARD_SIZEattribute in the file info to the given size.- Parameters:
size- agoffsetcontaining the file's size.
-
setSortOrder
public void setSortOrder(int sortOrder) Sets the sort order attribute in the file info structure. SeeG_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.- Parameters:
sortOrder- a sort order integer.
-
setSymbolicIcon
Sets the symbolic icon for a givenGFileInfo. SeeG_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.- Parameters:
icon- aGIcon.- Since:
- 2.34
-
setSymlinkTarget
Sets theG_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGETattribute in the file info to the given symlink target.- Parameters:
symlinkTarget- a static string containing a path to a symlink target.
-
unsetAttributeMask
public void unsetAttributeMask()Unsets a mask set by g_file_info_set_attribute_mask(), if one is set. -
builder
AFileInfo.Builderobject constructs aFileInfowith the specified properties. Use the variousset...()methods to set properties, and finish construction withFileInfo.Builder.build().- Returns:
- the builder object
-
GTimeValis deprecated due to the year 2038 problem.