Compartir a través de


IBasicFileAttributes.FileKey Method

Definition

Returns an object that uniquely identifies the given file, or null if a file key is not available.

[Android.Runtime.Register("fileKey", "()Ljava/lang/Object;", "GetFileKeyHandler:Java.Nio.FileNio.Attributes.IBasicFileAttributesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Lang.Object? FileKey ();
[<Android.Runtime.Register("fileKey", "()Ljava/lang/Object;", "GetFileKeyHandler:Java.Nio.FileNio.Attributes.IBasicFileAttributesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member FileKey : unit -> Java.Lang.Object

Returns

an object that uniquely identifies the given file, or null

Attributes

Remarks

Returns an object that uniquely identifies the given file, or null if a file key is not available. On some platforms or file systems it is possible to use an identifier, or a combination of identifiers to uniquely identify a file. Such identifiers are important for operations such as file tree traversal in file systems that support symbolic links or file systems that allow a file to be an entry in more than one directory. On UNIX file systems, for example, the <em>device ID</em> and <em>inode</em> are commonly used for such purposes.

The file key returned by this method can only be guaranteed to be unique if the file system and files remain static. Whether a file system re-uses identifiers after a file is deleted is implementation dependent and therefore unspecified.

File keys returned by this method can be compared for equality and are suitable for use in collections. If the file system and files remain static, and two files are the java.nio.file.Files#isSameFile same with non-null file keys, then their file keys are equal.

Java documentation for java.nio.file.attribute.BasicFileAttributes.fileKey().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to