Udostępnij za pośrednictwem


Files.CreateLink(IPath, IPath) Method

Definition

Creates a new link (directory entry) for an existing file (optional operation).

[Android.Runtime.Register("createLink", "(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? CreateLink (Java.Nio.FileNio.IPath? link, Java.Nio.FileNio.IPath? existing);
[<Android.Runtime.Register("createLink", "(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member CreateLink : Java.Nio.FileNio.IPath * Java.Nio.FileNio.IPath -> Java.Nio.FileNio.IPath

Parameters

link
IPath

the link (directory entry) to create

existing
IPath

a path to an existing file

Returns

the path to the link (directory entry)

Attributes

Remarks

Creates a new link (directory entry) for an existing file (optional operation).

The link parameter locates the directory entry to create. The existing parameter is the path to an existing file. This method creates a new directory entry for the file so that it can be accessed using link as the path. On some file systems this is known as creating a "hard link". Whether the file attributes are maintained for the file or for each directory entry is file system specific and therefore not specified. Typically, a file system requires that all links (directory entries) for a file be on the same file system. Furthermore, on some platforms, the Java virtual machine may require to be started with implementation specific privileges to create hard links or to create links to directories.

Java documentation for java.nio.file.Files.createLink(java.nio.file.Path, java.nio.file.Path).

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