作者:何其何从丶 | 来源:互联网 | 2023-06-21 10:25
本文整理了Java中org.apache.commons.vfs.FileName.getPathDecoded()
方法的一些代码示例,展示了FileName.getPathDecoded()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileName.getPathDecoded()
方法的具体详情如下:
包路径:org.apache.commons.vfs.FileName
类名称:FileName
方法名:getPathDecoded
FileName.getPathDecoded介绍
[英]Returns the absolute path of this file, within its file system. This path is normalised, so that .
and ..
elements have been removed. Also, the path only contains /
as its separator character. The path always starts with /
The root of a file system has /
as its absolute path.
In contrast to #getPath() the path is decoded i.e. all %nn stuff replaced by its character.
[中]返回此文件在其文件系统中的绝对路径。此路径已标准化,因此.
和..
元素已被删除。此外,路径仅包含/
作为分隔符。路径始终以/
开头
文件系统的根目录的绝对路径为/
。
与#getPath()相反,路径被解码,即所有%nn内容都被其字符替换。
代码示例
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.vfs
/**
* Attaches this file object to its file resource.
*/
protected void doAttach()
throws Exception
{
if (file == null)
{
// Remove the "file:///"
// LocalFileName localFileName = (LocalFileName) getName();
String fileName = rootFile + getName().getPathDecoded();
// fileName = UriParser.decode(fileName);
file = new File(fileName);
}
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.vfs
/**
* Creates an input stream to read the file content from.
*/
InputStream getInputStream(long filePointer) throws IOException
{
final ChannelSftp channel = fileSystem.getChannel();
try
{
// hmmm - using the in memory method is soooo much faster ...
// TODO - Don't read the entire file into memory. Use the
// stream-based methods on ChannelSftp once they work properly final
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
try
{
channel.get(getName().getPathDecoded(), outstr, null,
ChannelSftp.RESUME, filePointer);
}
catch (SftpException e)
{
throw new FileSystemException(e);
}
outstr.close();
return new ByteArrayInputStream(outstr.toByteArray());
}
finally
{
fileSystem.putChannel(channel);
}
}
代码示例来源:origin: org.geoserver.importer/importer-core
for (FileObject fo : containedFiles) {
String pathDecoded = fo.getName().getPathDecoded();
names.add(pathDecoded);
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
/**
* Attaches this file object to its file resource.
*/
protected void doAttach() throws Exception {
if (file == null) {
LayeredFileName layeredFileName = (LayeredFileName) getName();
String fileName = layeredFileName.getOuterName().getRootURI() + layeredFileName.getOuterName().getPathDecoded();
FileObject outer = getFileSystem().resolveFile(fileName);
if (outer instanceof TruezipFileObject) {
fileName = layeredFileName.getOuterName().getPathDecoded() + getName().getPathDecoded();
file = new File(fileName, ArchiveDetector.ALL);
}
else {
fileObject = outer;
DefaultFileSystemManager dfsMgr = (DefaultFileSystemManager) VFS.getManager();
file = new File(dfsMgr.getTemporaryFileStore().allocateFile(getName().getBaseName()));
}
}
}