本文整理汇总了Java中org.apache.commons.vfs2.provider.UriParser类的典型用法代码示例。如果您正苦于以下问题:Java UriParser类的具体用法?Java UriParser怎么用?Java UriParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriParser类属于org.apache.commons.vfs2.provider包,在下文中一共展示了UriParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doListChildren
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Lists the children of the file.
*
* @return the string[]
*
* @throws Exception the exception
*/
@Override
protected String[] doListChildren() throws Exception {
// List the children of this file
doGetChildren();
final String[] childNames = new String[children.size()];
int childNum = -1;
Iterator<FileInfo> iterChildren = children.values().iterator();
while (iterChildren.hasNext()) {
childNum++;
final FileInfo child = iterChildren.next();
childNames[childNum] = child.getName();
}
return UriParser.encode(childNames);
}
开发者ID:clstoulouse,项目名称:motu,代码行数:25,代码来源:GsiFtpFileObject.java
示例2: parseSchemeFileOptions
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Get file options specific to a particular scheme.
*
* @param fileURI URI of file to get file options
* @return File options related to scheme.
*/
private Map<String, String> parseSchemeFileOptions(String fileURI) {
String scheme;
if ((scheme = UriParser.extractScheme(fileURI)) == null) {
return null;
}
HashMap<String, String> schemeFileOptions = new HashMap<>();
schemeFileOptions.put(Constants.SCHEME, scheme);
if (scheme.equals(Constants.SCHEME_SFTP)) {
for (Constants.SftpFileOption option : Constants.SftpFileOption.values()) {
String strValue = fileProperties.get(Constants.SFTP_PREFIX + option.toString());
if (strValue != null && !strValue.isEmpty()) {
schemeFileOptions.put(option.toString(), strValue);
}
}
}
return schemeFileOptions;
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:24,代码来源:RemoteFileSystemConsumer.java
示例3: checkURIProtocolSupported
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
private boolean checkURIProtocolSupported(String uri) {
Map<String, String> environment = this.ctx.getExecMasterContext().getDpuContext().getEnvironment();
String supportedProtocols = environment.get(SUPPORTED_PROTOCOLS);
if (StringUtils.isEmpty(supportedProtocols)) {
return true;
}
final String scheme = UriParser.extractScheme(uri);
String[] supportedSchemes = supportedProtocols.trim().split(",");
Set<String> supportedSet = new HashSet<>();
for (String s : supportedSchemes) {
supportedSet.add(s);
}
if (StringUtils.isEmpty(scheme) && !supportedSet.contains("file")) {
return false;
}
return supportedSet.contains(scheme);
}
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:21,代码来源:FilesDownload.java
示例4: checkURIProtocolSupported
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
private boolean checkURIProtocolSupported(String uri) {
Map<String, String> environment = this.ctx.getDialogMasterContext().getDialogContext().getEnvironment();
String supportedProtocols = environment.get(FilesDownload.SUPPORTED_PROTOCOLS);
if (StringUtils.isEmpty(supportedProtocols)) {
return true;
}
final String scheme = UriParser.extractScheme(uri);
String[] supportedSchemes = supportedProtocols.trim().split(",");
Set<String> supportedSet = new HashSet<>();
for (String s : supportedSchemes) {
supportedSet.add(s);
}
if (StringUtils.isEmpty(scheme) && !supportedSet.contains("file")) {
return false;
}
return supportedSet.contains(scheme);
}
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:21,代码来源:FilesDownloadVaadinDialog.java
示例5: isAbsoluteName
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Determines if a name is an absolute file name.
* @param name The file name.
* @return true if the name is absolute, false otherwise.
*/
public boolean isAbsoluteName(final String name)
{
// TODO - this is yucky
StringBuilder b = new StringBuilder(name);
try
{
UriParser.fixSeparators(b);
extractRootPrefix(name, b);
return true;
}
catch (FileSystemException e)
{
return false;
}
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:21,代码来源:LocalFileNameParser.java
示例6: FtpFileObject
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
protected FtpFileObject(final AbstractFileName name,
final FtpFileSystem fileSystem,
final FileName rootName)
throws FileSystemException
{
super(name, fileSystem);
ftpFs = fileSystem;
String relPath = UriParser.decode(rootName.getRelativeName(name));
if (".".equals(relPath))
{
// do not use the "." as path against the ftp-server
// e.g. the uu.net ftp-server do a recursive listing then
// this.relPath = UriParser.decode(rootName.getPath());
// this.relPath = ".";
this.relPath = null;
}
else
{
this.relPath = relPath;
}
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:22,代码来源:FtpFileObject.java
示例7: getInfo
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Fetches the info for this file.
*/
private void getInfo(boolean flush) throws IOException
{
final FtpFileObject parent = (FtpFileObject) FileObjectUtils.getAbstractFileObject(getParent());
FTPFile newFileInfo;
if (parent != null)
{
newFileInfo = parent.getChildFile(UriParser.decode(getName().getBaseName()), flush);
}
else
{
// Assume the root is a directory and exists
newFileInfo = new FTPFile();
newFileInfo.setType(FTPFile.DIRECTORY_TYPE);
}
if (newFileInfo == null)
{
this.fileInfo = UNKNOWN;
}
else
{
this.fileInfo = newFileInfo;
}
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:28,代码来源:FtpFileObject.java
示例8: findFile
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Locates a file object, by absolute URI.
* @param baseFile The base file.
* @param uri The URI of the file to locate.
* @param fileSystemOptions The FileSystem options.
* @return the FileObject.
* @throws FileSystemException if an error occurs.
*/
public FileObject findFile(final FileObject baseFile,
final String uri,
final FileSystemOptions fileSystemOptions)
throws FileSystemException
{
StringBuilder buf = new StringBuilder(80);
UriParser.extractScheme(uri, buf);
String resourceName = buf.toString();
ClassLoader cl = ResourceFileSystemConfigBuilder.getInstance().getClassLoader(fileSystemOptions);
if (cl == null)
{
cl = getClass().getClassLoader();
}
final URL url = cl.getResource(resourceName);
if (url == null)
{
throw new FileSystemException("vfs.provider.url/badly-formed-uri.error", uri);
}
FileObject fo = getContext().getFileSystemManager().resolveFile(url.toExternalForm());
return fo;
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:33,代码来源:ResourceFileProvider.java
示例9: parseUri
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
@Override
public FileName parseUri(final VfsComponentContext context, final FileName base,
final String filename) throws FileSystemException
{
final StringBuilder name = new StringBuilder();
// Extract the scheme and authority parts
final Authority auth = extractToPath(filename, name);
// extract domain
String username = auth.getUserName();
final String domain = extractDomain(username);
if (domain != null)
{
username = username.substring(domain.length() + 1);
}
// Decode and adjust separators
UriParser.canonicalizePath(name, 0, name.length(), this);
UriParser.fixSeparators(name);
// Normalise the path. Do this after extracting the share name,
// to deal with things like Nfs://hostname/share/..
final FileType fileType = UriParser.normalisePath(name);
final String path = name.toString();
return new NfsFileName(
auth.getScheme(),
auth.getHostName(),
auth.getPort(),
username,
auth.getPassword(),
path,
fileType);
}
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:37,代码来源:NfsFileNameParser.java
示例10: doListChildren
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Lists the children of the file. Is only called if {@link #doGetType}
* returns {@link FileType#FOLDER}.
*/
@Override
protected String[] doListChildren() throws Exception
{
// VFS-210: do not try to get listing for anything else than directories
if (!file.isDirectory())
{
return null;
}
return UriParser.encode(file.list());
}
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:16,代码来源:NfsFileObject.java
示例11: GsiFtpFileObject
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Instantiates a new gsi ftp file object.
*
* @param name the name
* @param fileSystem the file system
* @param rootName the root name
*
* @throws FileSystemException the file system exception
*/
protected GsiFtpFileObject(final AbstractFileName name, final GsiFtpFileSystem fileSystem, final FileName rootName) throws FileSystemException {
super(name, fileSystem);
ftpFs = fileSystem;
String relPathTmp = UriParser.decode(rootName.getRelativeName(name));
// log.debug("FileName=" + name + " Root=" + rootName
// + " Relative path=" + relPath );
if (".".equals(relPathTmp)) {
// do not use the "." as path against the ftp-server
// e.g. the uu.net ftp-server do a recursive listing then
// this.relPath = UriParser.decode(rootName.getPath());
// this.relPath = ".";
// boolean ok = true;
// try {
// cwd = ftpFs.getClient().getCurrentDir();
// }
// catch (ServerException se) { ok = false;}
// catch (IOException se) { ok = false;}
// if ( ! ok ) {
// throw new FileSystemException("vfs.provider.gsiftp/get-type.error", getName());
// }
this.relPath = "/"; // cwd;
} else {
this.relPath = relPathTmp;
}
}
开发者ID:clstoulouse,项目名称:motu,代码行数:38,代码来源:GsiFtpFileObject.java
示例12: onChildrenChanged
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Called when the children of this file change.
*
* @param child the child
* @param newType the new type
*/
@Override
protected void onChildrenChanged(FileName child, FileType newType) {
if (children != null && newType.equals(FileType.IMAGINARY)) {
try {
children.remove(UriParser.decode(child.getBaseName()));
} catch (FileSystemException e) {
throw new RuntimeException(e.getMessage());
}
} else {
// if child was added we have to rescan the children
children = null;
}
}
开发者ID:clstoulouse,项目名称:motu,代码行数:20,代码来源:GsiFtpFileObject.java
示例13: parseSchemeFileOptions
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
private Map<String, String> parseSchemeFileOptions(String fileURI) {
String scheme = UriParser.extractScheme(fileURI);
if (scheme == null) {
return null;
}
HashMap<String, String> schemeFileOptions = new HashMap<>();
schemeFileOptions.put(Constants.SCHEME, scheme);
addOptions(scheme, schemeFileOptions);
return schemeFileOptions;
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:11,代码来源:FileConsumer.java
示例14: parseUri
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
public FileName parseUri(final VfsComponentContext context, FileName base, final String filename)
throws FileSystemException
{
final StringBuilder name = new StringBuilder();
// Extract the scheme
String scheme = UriParser.extractScheme(filename, name);
if (scheme == null)
{
scheme = "file";
}
// Remove encoding, and adjust the separators
UriParser.canonicalizePath(name, 0, name.length(), this);
UriParser.fixSeparators(name);
// Extract the root prefix
final String rootFile = extractRootPrefix(filename, name);
// Normalise the path
FileType fileType = UriParser.normalisePath(name);
final String path = name.toString();
return createFileName(
scheme,
rootFile,
path,
fileType);
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:32,代码来源:LocalFileNameParser.java
示例15: findLocalFile
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Finds a local file.
* @param file The File to locate.
* @return the located FileObject.
* @throws FileSystemException if an error occurs.
*/
public FileObject findLocalFile(final File file)
throws FileSystemException
{
return findLocalFile(UriParser.encode(file.getAbsolutePath()));
// return findLocalFile(file.getAbsolutePath());
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:13,代码来源:DefaultLocalFileProvider.java
示例16: findFile
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Locates a file object, by absolute URI.
* @param baseFile The base FileObject.
* @param uri The URI of the file to be located.
* @param properties FileSystemOptions to use to locate or create the file.
* @return The FileObject.
* @throws FileSystemException if an error occurs.
*/
public synchronized FileObject findFile(final FileObject baseFile, final String uri,
final FileSystemOptions properties)
throws FileSystemException
{
// Parse the name
final StringBuilder buffer = new StringBuilder(uri);
final String scheme = UriParser.extractScheme(uri, buffer);
UriParser.fixSeparators(buffer);
FileType fileType = UriParser.normalisePath(buffer);
final String path = buffer.toString();
// Create the temp file system if it does not exist
// FileSystem filesystem = findFileSystem( this, (Properties) null);
FileSystem filesystem = findFileSystem(this, properties);
if (filesystem == null)
{
if (rootFile == null)
{
rootFile = getContext().getTemporaryFileStore().allocateFile("tempfs");
}
final FileName rootName =
getContext().parseURI(scheme + ":" + FileName.ROOT_PATH);
// final FileName rootName =
// new LocalFileName(scheme, scheme + ":", FileName.ROOT_PATH);
filesystem = new LocalFileSystem(rootName, rootFile.getAbsolutePath(), properties);
addFileSystem(this, filesystem);
}
// Find the file
return filesystem.resolveFile(path);
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:42,代码来源:TemporaryFileProvider.java
示例17: onChildrenChanged
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Called when the children of this file change.
*/
@Override
protected void onChildrenChanged(FileName child, FileType newType)
{
if (children != null && newType.equals(FileType.IMAGINARY)) {
if (!(children.isEmpty())) {
try {
if (children.containsKey(UriParser.decode(child.getBaseName()))) {
children.remove(UriParser.decode(child.getBaseName()));
} else {
if (log.isDebugEnabled()) {
log.debug("Map does not contain the " + child.getBaseName() + "in the map");
}
}
} catch (FileSystemException e) {
throw new RuntimeException(e.getMessage());
}
} else {
if (log.isDebugEnabled()) {
log.debug("EMPTY_FTP_FILE_MAP returned empty collection.");
}
}
} else
{
// if child was added we have to rescan the children
// TODO - get rid of this
children = null;
}
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:32,代码来源:FtpFileObject.java
示例18: doListChildren
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* Lists the children of the file.
*/
@Override
protected String[] doListChildren()
throws Exception
{
// List the children of this file
doGetChildren();
// VFS-210
if (children == null)
{
return null;
}
// TODO - get rid of this children stuff
final String[] childNames = new String[children.size()];
int childNum = -1;
Iterator<FTPFile> iterChildren = children.values().iterator();
while (iterChildren.hasNext())
{
childNum++;
final FTPFile child = iterChildren.next();
childNames[childNum] = child.getName();
}
return UriParser.encode(childNames);
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:30,代码来源:FtpFileObject.java
示例19: SftpFileObject
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
protected SftpFileObject(final AbstractFileName name,
final SftpFileSystem fileSystem) throws FileSystemException
{
super(name, fileSystem);
this.fileSystem = fileSystem;
relPath = UriParser.decode(fileSystem.getRootName().getRelativeName(
name));
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:9,代码来源:SftpFileObject.java
示例20: createFilename
import org.apache.commons.vfs2.provider.UriParser; //导入依赖的package包/类
/**
* create the temporary file name
* @param baseName The base to prepend to the file name being created.
* @return the name of the File.
*/
protected String createFilename(final String baseName)
{
// BUG29007
// return baseName + "_" + getFilecount() + ".tmp";
// [email protected]: BUG34976 get rid of maybe reserved and dangerous characters
// e.g. to allow replication of http://hostname.org/fileservlet?file=abc.txt
String safeBasename = UriParser.encode(baseName, TMP_RESERVED_CHARS).replace('%', '_');
return "tmp_" + getFilecount() + "_" + safeBasename;
}
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:DefaultFileReplicator.java
注:本文中的org.apache.commons.vfs2.provider.UriParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论