当前位置: 首页>>代码示例>>Java>>正文


Java FileType类代码示例

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


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


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