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


Java FileType.FILE属性代码示例

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


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

示例1: getFileType

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,代码行数:17,代码来源:SFTPClient.java

示例2: FileExists

/**
 * 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,代码行数:21,代码来源:JobEntrySSH2GET.java

示例3: includeFile

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,代码行数:26,代码来源:JobEntryAddResultFilenames.java

示例4: includeFile

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,代码行数:26,代码来源:Mail.java

示例5: FileExists

/**
 * 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,代码行数:21,代码来源:JobEntrySSH2GET.java

示例6: includeFile

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,代码行数:26,代码来源:JobEntryAddResultFilenames.java

示例7: includeFile

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,代码行数:26,代码来源:Mail.java

示例8: doGetType

/**
    * 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,代码行数:19,代码来源:MimeFileObject.java

示例9: doGetType

/**
 * Determines the type of this file.  Must not return null.  The return
 * value of this method is cached, so the implementation can be expensive.
 */
protected FileType doGetType()
    throws Exception
{
    // Use the HEAD method to probe the file.
    method = new HeadMethod();
    setupMethod(method);
    final HttpClient client = fileSystem.getClient();
    final int status = client.executeMethod(method);
    method.releaseConnection();
    if (status == HttpURLConnection.HTTP_OK)
    {
        return FileType.FILE;
    }
    else if (status == HttpURLConnection.HTTP_NOT_FOUND
        || status == HttpURLConnection.HTTP_GONE)
    {
        return FileType.IMAGINARY;
    }
    else
    {
        throw new FileSystemException("vfs.provider.http/head.error", getName());
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:27,代码来源:HttpFileObject.java

示例10: assertSameContent

/**
 * 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,代码行数:22,代码来源:ContentTests.java

示例11: setTarEntry

/**
 * Sets the details for this file object.
 */
protected void setTarEntry(final TarEntry entry)
{
    if (this.entry != null)
    {
        return;
    }

    if ((entry == null) || (entry.isDirectory()))
    {
        type = FileType.FOLDER;
    }
    else
    {
        type = FileType.FILE;
    }

    this.entry = entry;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:21,代码来源:TarFileObject.java

示例12: doGetType

protected FileType doGetType() throws Exception {
	if ("".equals(this.getS3Key()) || this.getS3Key().endsWith("/") ) {
		return FileType.FOLDER;
	}else{
		return FileType.FILE;
	}
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:7,代码来源:S3FileObject.java

示例13: getRowNumber

private void getRowNumber() throws KettleException
{
	try
	{
		if (data.file.getType() == FileType.FILE)
		{
			data.fr = KettleVFS.getInputStream(data.file);
			data.isr = new InputStreamReader(new BufferedInputStream(data.fr, BUFFER_SIZE_INPUT_STREAM));
				
			int c = 0;				
			data.lineStringBuffer.setLength(0);
			
			 while (c >= 0)
	         {
			     c = data.isr.read();
	
	             if (c == data.separator)
	             {
	                 // Move Row number pointer ahead
	               	 data.rownr ++;	
				 }	                        
	         }
		}
		if(log.isDetailed()) log.logDetailed(toString(),Messages.getString("GetFilesRowsCount.Log.RowsInFile", data.file.toString(), ""+data.rownr));
	}
	catch (Exception e)
	{
		throw new KettleException(e);
	}
  
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:GetFilesRowsCount.java

示例14: getRowNumber

private void getRowNumber() throws KettleException {
  try {
    if (data.file.getType() == FileType.FILE) {
      data.fr = KettleVFS.getInputStream(data.file);
      // Avoid method calls - see here:
      // http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/
      byte buf[] = new byte[8192]; // BufferedaInputStream default buffer size
      int n;
      while ((n = data.fr.read(buf)) != -1) {
        for (int i = 0; i < n; i++) {
          if (buf[i] == data.separator) {
            data.rownr++;
          }
        }
      }
    }
    if (log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "GetFilesRowsCount.Log.RowsInFile", data.file.toString(), "" + data.rownr));
  } catch (Exception e) {
    throw new KettleException(e);
  } finally {
    // Close inputstream - not used except for counting
    if (data.fr != null) {
      BaseStep.closeQuietly(data.fr);
      data.fr = null;
    }
  }

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:28,代码来源:GetFilesRowsCount.java

示例15: initFs

public void initFs() throws Exception {
  FileSystem parentFs = mock( FileSystem.class );
  FileObject parentLayer = mock( FileObject.class );
  File file = mock( File.class );

  when( parentLayer.getFileSystem() ).thenReturn( parentFs );
  when( parentFs.replicateFile( parentLayer, Selectors.SELECT_SELF ) ).thenReturn( file );
  when( file.exists() ).thenReturn( true );
  fs = new ZipFileSystem( new VirtualFileName( "/", "", FileType.FILE ), parentLayer, null );
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:10,代码来源:ZipFileSystemCacheTest.java


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