本文整理了Java中java.io.File.realpath()
方法的一些代码示例,展示了File.realpath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.realpath()
方法的具体详情如下:
包路径:java.io.File
类名称:File
方法名:realpath
[英]TODO: move this stuff to libcore.os.
[中]
代码示例来源:origin: robovm/robovm
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Returns the canonical path of this file.
* An <i>absolute</i> path is one that begins at the root of the file system.
* A <i>canonical</i> path is an absolute path with symbolic links
* and references to "." or ".." resolved. If a path element does not exist (or
* is not searchable), there is a conflict between interpreting canonicalization
* as a textual operation (where "a/../b" is "b" even if "a" does not exist) .
*
* <p>Most callers should use {@link #getAbsolutePath} instead. A canonical path is
* significantly more expensive to compute, and not generally useful. The primary
* use for canonical paths is determining whether two paths point to the same file by
* comparing the canonicalized paths.
*
* <p>It can be actively harmful to use a canonical path, specifically because
* canonicalization removes symbolic links. It's wise to assume that a symbolic link
* is present for a reason, and that that reason is because the link may need to change.
* Canonicalization removes this layer of indirection. Good code should generally avoid
* caching canonical paths.
*
* @return the canonical path of this file.
* @throws IOException
* if an I/O error occurs.
*/
public String getCanonicalPath() throws IOException {
return realpath(getAbsolutePath());
}
内容来源于网络,如有侵权,请联系作者删除!