• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FileType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.vfs.FileType的典型用法代码示例。如果您正苦于以下问题:Java FileType类的具体用法?Java FileType怎么用?Java FileType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileType类属于org.apache.commons.vfs包,在下文中一共展示了FileType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseUri

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Parses URI and constructs S3 file name.
 */
public FileName parseUri(final VfsComponentContext context, final FileName base, final String filename) throws FileSystemException {
	StringBuffer name = new StringBuffer();

	String scheme = UriParser.extractScheme(filename, name);
	UriParser.canonicalizePath(name, 0, name.length(), this);

	// Normalize separators in the path
	UriParser.fixSeparators(name);

	// Normalise the path
	FileType fileType = UriParser.normalisePath(name);

	// Extract bucket name
	final String bucketName = UriParser.extractFirstElement(name);

	return new S3FileName(scheme, bucketName, name.toString(), fileType);
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:21,代码来源:S3FileNameParser.java


示例2: handle

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public FtpReplay handle(String command, String params)
        throws CommandException, FileSystemException
{
    String arg = params;
    FileObject file = getPath(arg); 

    if (!file.exists())
        throw new CommandException(550, arg + ": no such file");
    if (file.getType().equals(FileType.FOLDER))
        throw new CommandException(550, arg + ": not a plain file");

    Representation representation = getServerPI().dtp.getRepresentation();
    long size;
    try
    {
        size = representation.sizeOf(file);
    }
    catch (IOException e)
    {
        throw new CommandException(550, e.getMessage());
    }

    // XXX: in ascii mode, we must count newlines properly
    return FtpReplay.createReplay(213, "{0}",size);
}
 
开发者ID:PhantomYdn,项目名称:jvfsftpd,代码行数:26,代码来源:SizeHandler.java


示例3: service

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
  FileObject object = VFSBackend.resolveFile(request.getPathInfo());

  if (object.exists()) {
    if (FileType.FOLDER.equals(object.getType())) {
      response.sendError(HttpServletResponse.SC_FORBIDDEN);
      return;
    }

    setHeader(response, object.getContent());

    InputStream is = object.getContent().getInputStream();
    OutputStream os = response.getOutputStream();
    Util.copyStream(is, os);
    is.close();
  } else {
    response.sendError(HttpServletResponse.SC_NOT_FOUND);
  }
}
 
开发者ID:thinkberg,项目名称:moxo,代码行数:20,代码来源:GetHandler.java


示例4: service

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
  response.setHeader("DAV", "1, 2");

  String path = request.getPathInfo();
  StringBuffer options = new StringBuffer();
  FileObject object = VFSBackend.resolveFile(path);
  if (object.exists()) {
    options.append("OPTIONS, GET, HEAD, POST, DELETE, TRACE, COPY, MOVE, LOCK, UNLOCK, PROPFIND");
    if (FileType.FOLDER.equals(object.getType())) {
      options.append(", PUT");
    }
  } else {
    options.append("OPTIONS, MKCOL, PUT, LOCK");
  }
  response.setHeader("Allow", options.toString());

  // see: http://www-128.ibm.com/developerworks/rational/library/2089.html
  response.setHeader("MS-Author-Via", "DAV");
}
 
开发者ID:thinkberg,项目名称:moxo,代码行数:20,代码来源:OptionsHandler.java


示例5: getFileType

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public FileType getFileType(String filename) throws KettleJobException
 {
try {
	SftpATTRS attrs=c.stat(filename);
		if (attrs == null)	return FileType.IMAGINARY;
		
		if ((attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) == 0)
			throw new KettleJobException("Unknown permissions error");

		if (attrs.isDir())
			return FileType.FOLDER;
		else
			return FileType.FILE;
} catch (Exception e) {
		throw new KettleJobException(e);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:18,代码来源:SFTPClient.java


示例6: FileExists

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Check existence of a local file
 * 
 * @param filename
 * @return true, if file exists
 */
public boolean FileExists(String filename) {
    
	FileObject file=null;
    try {
    	file=KettleVFS.getFileObject(filename);
    	if(!file.exists()) return false;
    	else
    	{
    		if(file.getType() == FileType.FILE) return true;
    		else return false;
    	}
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:JobEntrySSH2GET.java


示例7: getFiles

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
private List<FileObject> getFiles(String localfolder) throws IOException
  {
List<FileObject> myFileList = new ArrayList<FileObject>();

// Get all the files in the local directory...

FileObject localFiles = KettleVFS.getFileObject(localfolder);
FileObject[] children = localFiles.getChildren();
if (children!=null) 
{
	for (int i=0; i<children.length; i++) 
	{
           // Get filename of file or directory
		if (children[i].getType().equals(FileType.FILE)) 
		{
			myFileList.add(children[i]);
			
		}
       } // end for
}

return myFileList;
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:JobEntrySSH2PUT.java


示例8: includeFile

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public boolean includeFile(FileSelectInfo info) 
{
	boolean returncode=false;
	try
	{
		if (!info.getFile().toString().equals(source_folder))
		{
			// Pass over the Base folder itself
			String short_filename= info.getFile().getName().getBaseName();
			
			if (info.getFile().getParent().equals(info.getBaseFolder()) ||
				(!info.getFile().getParent().equals(info.getBaseFolder()) && includeSubfolders))	
			 {
				if((info.getFile().getType() == FileType.FILE && file_wildcard==null) ||
				(info.getFile().getType() == FileType.FILE && file_wildcard!=null && GetFileWildcard(short_filename,file_wildcard)))
					returncode=true;
			 }	
		}
	}
	catch (Exception e) 
	{
		log.logError(toString(), "Error while finding files ... in [" + info.getFile().toString() + "]. Exception :"+e.getMessage());
		 returncode= false;
	}
	return returncode;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:JobEntryAddResultFilenames.java


示例9: includeFile

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public boolean includeFile(FileSelectInfo info) 
{
	boolean returncode=false;
	try
	{
		if (!info.getFile().toString().equals(source_folder))
		{
			// Pass over the Base folder itself
			String short_filename= info.getFile().getName().getBaseName();
			
			if (info.getFile().getParent().equals(info.getBaseFolder()) ||
				((!info.getFile().getParent().equals(info.getBaseFolder()) && meta.isIncludeSubFolders())))	
			 {
				if((info.getFile().getType() == FileType.FILE && file_wildcard==null) ||
				(info.getFile().getType() == FileType.FILE && file_wildcard!=null && GetFileWildcard(short_filename,file_wildcard)))
					returncode=true;
			 }	
		}	
	}
	catch (Exception e) 
	{
		log.logError(toString(), Messages.getString("Mail.Error.FindingFiles", info.getFile().toString(),e.getMessage()));
		 returncode= false;
	}
	return returncode;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:Mail.java


示例10: FileExists

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Check existence of a local file
 * 
 * @param filename
 * @return true, if file exists
 */
public boolean FileExists(String filename) {
    
	FileObject file=null;
    try {
    	file=KettleVFS.getFileObject(filename, this);
    	if(!file.exists()) return false;
    	else
    	{
    		if(file.getType() == FileType.FILE) return true;
    		else return false;
    	}
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:JobEntrySSH2GET.java


示例11: includeFile

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public boolean includeFile(FileSelectInfo info) 
{
	boolean returncode=false;
	try
	{
		if (!info.getFile().toString().equals(source_folder))
		{
			// Pass over the Base folder itself
			String short_filename= info.getFile().getName().getBaseName();
			
			if (info.getFile().getParent().equals(info.getBaseFolder()) ||
				(!info.getFile().getParent().equals(info.getBaseFolder()) && includeSubfolders))	
			 {
				if((info.getFile().getType() == FileType.FILE && file_wildcard==null) ||
				(info.getFile().getType() == FileType.FILE && file_wildcard!=null && GetFileWildcard(short_filename,file_wildcard)))
					returncode=true;
			 }	
		}
	}
	catch (Exception e) 
	{
		logError("Error while finding files ... in [" + info.getFile().toString() + "]. Exception :"+e.getMessage());
		 returncode= false;
	}
	return returncode;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:JobEntryAddResultFilenames.java


示例12: loadRepositoryDirectoryTree

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree(RepositoryDirectoryInterface dir) throws KettleException {
	try {
		String folderName = calcDirectoryName(dir);
		FileObject folder = KettleVFS.getFileObject(folderName);
		
		for (FileObject child : folder.getChildren()) {
			if (child.getType().equals(FileType.FOLDER)) {
			  if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
				RepositoryDirectory subDir = new RepositoryDirectory(dir, child.getName().getBaseName());
				subDir.setObjectId(new StringObjectId(calcObjectId(subDir)));
				dir.addSubdirectory(subDir);
				
				loadRepositoryDirectoryTree(subDir);
			  }
			}
		}
		
		return dir;
	}
	catch(Exception e) {
		throw new KettleException("Unable to load the directory tree from this file repository", e);
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:KettleFileRepository.java


示例13: includeFile

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public boolean includeFile(FileSelectInfo info) 
{
	boolean returncode=false;
	try
	{
		if (!info.getFile().toString().equals(source_folder))
		{
			// Pass over the Base folder itself
			String short_filename= info.getFile().getName().getBaseName();
			
			if (info.getFile().getParent().equals(info.getBaseFolder()) ||
				((!info.getFile().getParent().equals(info.getBaseFolder()) && meta.isIncludeSubFolders())))	
			 {
				if((info.getFile().getType() == FileType.FILE && file_wildcard==null) ||
				(info.getFile().getType() == FileType.FILE && file_wildcard!=null && GetFileWildcard(short_filename,file_wildcard)))
					returncode=true;
			 }	
		}	
	}
	catch (Exception e) 
	{
		logError(BaseMessages.getString(PKG, "Mail.Error.FindingFiles", info.getFile().toString(),e.getMessage()));
		 returncode= false;
	}
	return returncode;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:Mail.java


示例14: handleDelete

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Called when this file is deleted.  Updates cached info and notifies
 * subclasses, parent and file system.
 */
protected void handleDelete() throws Exception
{
    synchronized (fs)
    {
        if (attached)
        {
            // Fix up state
            injectType(FileType.IMAGINARY);
            removeChildrenCache();
            // children = null;

            // Notify subclass
            onChange();
        }

        // Notify parent that its child list may no longer be valid
        notifyParent(this.getName(), FileType.IMAGINARY);

        // Notify the file system
        fs.fireFileDeleted(this);
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:27,代码来源:AbstractFileObject.java


示例15: doGetType

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
protected FileType doGetType() throws FileSystemException
{
    if (file != null)
    {
        return file.getType();
    }
    else if (children.size() > 0)
    {
        return FileType.FOLDER;
    }
    else
    {
        return FileType.IMAGINARY;
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:20,代码来源:DelegateFileObject.java


示例16: parseUri

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public FileName parseUri(final VfsComponentContext context, FileName base, final String filename)
        throws FileSystemException
{
    // FTP URI are generic URI (as per RFC 2396)
    final StringBuffer name = new StringBuffer();

    // Extract the scheme and authority parts
    final Authority auth = extractToPath(filename, name);

    // Decode and normalise the file name
    UriParser.canonicalizePath(name, 0, name.length(), this);
    UriParser.fixSeparators(name);
    FileType fileType = UriParser.normalisePath(name);
    final String path = name.toString();

    return new GenericFileName(
        auth.scheme,
        auth.hostName,
        auth.port,
        defaultPort,
        auth.userName,
        auth.password,
        path,
        fileType);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:26,代码来源:HostFileNameParser.java


示例17: loadRepositoryDirectoryTree

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree(RepositoryDirectoryInterface dir) throws KettleException {
	try {
		String folderName = calcDirectoryName(dir);
		FileObject folder = KettleVFS.getFileObject(folderName);
		
     for (FileObject child : folder.getChildren()) {
       if (child.getType().equals(FileType.FOLDER)) {
         if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
           RepositoryDirectory subDir = new RepositoryDirectory(dir, child.getName().getBaseName());
           subDir.setObjectId(new StringObjectId(calcObjectId(subDir)));
           dir.addSubdirectory(subDir);

           loadRepositoryDirectoryTree(subDir);
         }
       }
     }

		return dir;
	}
	catch(Exception e) {
		throw new KettleException("Unable to load the directory tree from this file repository", e);
	}
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:24,代码来源:KettleFileRepository.java


示例18: assertSameContent

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Asserts every file in a folder exists and has the expected content.
 */
private void assertSameContent(final FileInfo expected,
                               final FileObject folder) throws Exception
{
    for (Iterator iterator = expected.children.values().iterator(); iterator.hasNext();)
    {
        final FileInfo fileInfo = (FileInfo) iterator.next();
        final FileObject child = folder.resolveFile(fileInfo.baseName, NameScope.CHILD);

        assertTrue(child.getName().toString(), child.exists());
        if (fileInfo.type == FileType.FILE)
        {
            assertSameContent(fileInfo.content, child);
        }
        else
        {
            assertSameContent(fileInfo, child);
        }
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:23,代码来源:ContentTests.java


示例19: listChildren

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
 * Lists the children of a folder.
 */
private void listChildren(final FileObject dir,
                          final boolean recursive,
                          final String prefix)
    throws FileSystemException
{
    final FileObject[] children = dir.getChildren();
    for (int i = 0; i < children.length; i++)
    {
        final FileObject child = children[i];
        System.out.print(prefix);
        System.out.print(child.getName().getBaseName());
        if (child.getType() == FileType.FOLDER)
        {
            System.out.println("/");
            if (recursive)
            {
                listChildren(child, recursive, prefix + "    ");
            }
        }
        else
        {
            System.out.println();
        }
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:29,代码来源:Shell.java


示例20: doGetType

import org.apache.commons.vfs.FileType; //导入依赖的package包/类
/**
    * Determines the type of the file, returns null if the file does not
    * exist.
    */
   protected FileType doGetType() throws Exception
   {
	if (part == null)
	{
		return FileType.IMAGINARY;
	}

	if (isMultipart())
	{
		// we cant have children ...
		return FileType.FILE_OR_FOLDER;
	}

	return FileType.FILE;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:20,代码来源:MimeFileObject.java



注:本文中的org.apache.commons.vfs.FileType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CyColumn类代码示例发布时间:2022-05-22
下一篇:
Java LonLat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap