當前位置: 首頁>>代碼示例>>Java>>正文


Java FileType.FOLDER屬性代碼示例

本文整理匯總了Java中org.apache.commons.vfs2.FileType.FOLDER屬性的典型用法代碼示例。如果您正苦於以下問題:Java FileType.FOLDER屬性的具體用法?Java FileType.FOLDER怎麽用?Java FileType.FOLDER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.vfs2.FileType的用法示例。


在下文中一共展示了FileType.FOLDER屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doGetType

/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
@Override
protected FileType doGetType() throws Exception
{
    if (!file.exists())
    {
        return FileType.IMAGINARY;
    }
    else if (file.isDirectory())
    {
        return FileType.FOLDER;
    }
    else if (file.isFile())
    {
        return FileType.FILE;
    }

    throw new FileSystemException("vfs.provider.Nfs/get-type.error", getName());
}
 
開發者ID:danniss,項目名稱:common-vfs2-nfs,代碼行數:22,代碼來源:NfsFileObject.java

示例2: doGetType

/**
 * Determines the type of the file, returns null if the file does not exist.
 * 
 * @return the file type
 * 
 * @throws Exception the exception
 */
@Override
protected FileType doGetType() throws Exception {
    // log.debug("relative path:" + relPath);

    if (this.fileInfo == null) {
        return FileType.IMAGINARY;
    } else if (this.fileInfo.isDirectory()) {
        return FileType.FOLDER;
    } else if (this.fileInfo.isFile()) {
        return FileType.FILE;
    } else if (this.fileInfo.isSoftLink()) {
        return FileType.FILE; // getLinkDestination().getType();
    }

    throw new FileSystemException("vfs.provider.gsiftp/get-type.error", getName());
}
 
開發者ID:clstoulouse,項目名稱:motu,代碼行數:23,代碼來源:GsiFtpFileObject.java

示例3: listChildren

/**
 * Lists the children of a folder.
 */
public 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:kervinpierre,項目名稱:vfs-azure,代碼行數:28,代碼來源:SimpleShell.java

示例4: doInBackground

@Override
protected Void doInBackground() throws Exception {
  try {
    for (FileObject f : selectedFiles) {
      if (f.getType() == FileType.FOLDER) {
        continue;
      }
      final FileObjectToImport fileObjectToImport = new FileObjectToImport(
          f,
          f.getName(),
          new FileSize(f.getContent().getSize()),
          Level.FINEST,
          OpenMode.FROM_START,
          CanParse.NOT_TESTED);
      publish(fileObjectToImport);
    }
    return null;
  } catch (Exception e) {
    return null;
  }
}
 
開發者ID:otros-systems,項目名稱:otroslogviewer,代碼行數:21,代碼來源:AdvanceOpenPanel.java

示例5: findResources

private static Resources findResources(FileObject rootDir, String inputEncoding) throws IOException {
	Resources result = new Resources();
	FileObject[] allFiles = rootDir.findFiles(new AllFileSelector());
	for(int i = 0; i < allFiles.length; i++) {
		FileObject file = allFiles[i];
		if (file.getType() == FileType.FOLDER) {
			continue;
		}
		MediaType mediaType = MediatypeService.determineMediaType(file.getName().getBaseName()); 
		if(mediaType == null) {
			continue;
		}
		String href = file.getName().toString().substring(rootDir.getName().toString().length() + 1);
		byte[] resourceData = IOUtils.toByteArray(file.getContent().getInputStream());
		if(mediaType == MediatypeService.XHTML && ! nl.siegmann.epublib.Constants.CHARACTER_ENCODING.equalsIgnoreCase(inputEncoding)) {
			resourceData = ResourceUtil.recode(inputEncoding, nl.siegmann.epublib.Constants.CHARACTER_ENCODING, resourceData);
		}
		Resource fileResource = new Resource(null, resourceData, href, mediaType);
		result.add(fileResource);
	}
	return result;
}
 
開發者ID:DASAR,項目名稱:epublib-android,代碼行數:22,代碼來源:ChmParser.java

示例6: doGetType

/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
@Override
protected FileType doGetType() throws Exception
{
    if (!file.exists())
    {
        return FileType.IMAGINARY;
    }
    else if (file.isDirectory())
    {
        return FileType.FOLDER;
    }
    else if (file.isFile())
    {
        return FileType.FILE;
    }

    throw new FileSystemException("vfs.provider.smb/get-type.error", getName());
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:22,代碼來源:SmbFileObject.java

示例7: setZipEntry

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

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

    this.entry = entry;
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:21,代碼來源:ZipFileObject.java

示例8: doGetType

/**
 * Returns the file's type.
 */
@Override
protected FileType doGetType() throws Exception
{
    // JDK BUG: 6192331
    // if (!file.exists())
    if (!file.exists() && file.length() < 1)
    {
        return FileType.IMAGINARY;
    }

    if (file.isDirectory())
    {
        return FileType.FOLDER;
    }

    // In doubt, treat an existing file as file
    // if (file.isFile())
    // {
        return FileType.FILE;
    // }

    // throw new FileSystemException("vfs.provider.local/get-type.error", file);
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:26,代碼來源:LocalFile.java

示例9: doGetType

/** Returns the file's type. */
@Override
protected FileType doGetType() throws Exception {
    // JDK BUG: 6192331
    // if (!file.exists())
    if (!file.exists() && file.length() < 1) {
        return FileType.IMAGINARY;
    }

    if (file.isDirectory()) {
        return FileType.FOLDER;
    }

    // In doubt, treat an existing file as file
    // if (file.isFile())
    // {
    return FileType.FILE;
    // }

    // throw new FileSystemException("vfs.provider.local/get-type.error", file);
}
 
開發者ID:AludraTest,項目名稱:aludratest,代碼行數:21,代碼來源:AludraLocalFile.java

示例10: 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:wso2,項目名稱:wso2-commons-vfs,代碼行數:21,代碼來源:TarFileObject.java

示例11: doGetType

/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
@Override
protected FileType doGetType() throws FileSystemException
{
    if (file != null)
    {
        return file.getType();
    }
    else if (children.size() > 0)
    {
        return FileType.FOLDER;
    }
    else
    {
        return FileType.IMAGINARY;
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:20,代碼來源:DelegateFileObject.java

示例12: traverseDescendents

@Override
public boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception {
    if (fileInfo.getFile().getType() == FileType.FOLDER && fileInfo.getDepth() == 0) {
        return true;
    } else if (this.directoryFilter != null) {
        return this.directoryFilter.accept(fileInfo);
    } else {
        return this.traverseDescendents;
    }
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:10,代碼來源:BasicFileSelector.java

示例13: accept

@Override
public boolean accept(FileSelectInfo fileInfo) {
    try {
        return fileInfo.getFile().getType() == FileType.FOLDER;
    } catch (FileSystemException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:8,代碼來源:DirectoryFileFilter.java

示例14: folderMove

/**
 * Move the folder
 *
 * @param destination            New location of the folder
 * @param source                 Location of the folder
 * @param messageContext         The message context that is processed by a handler in the handle method
 * @param includeParentDirectory Boolean type
 * @param manager                Standard file system manager
 */
private void folderMove(String source, String destination, String filePattern, boolean includeParentDirectory,
                        MessageContext messageContext, StandardFileSystemManager manager) throws IOException {
    FileObject remoteFile = manager.resolveFile(source, FileConnectorUtils.init(messageContext));
    FileObject file = manager.resolveFile(destination, FileConnectorUtils.init(messageContext));
    if (StringUtils.isNotEmpty(filePattern)) {
        FileObject[] children = remoteFile.getChildren();
        for (FileObject child : children) {
            if (child.getType() == FileType.FILE) {
                moveFileWithPattern(child, destination, filePattern, manager, messageContext);
            } else if (child.getType() == FileType.FOLDER) {
                String newSource = source + File.separator + child.getName().getBaseName();
                folderMove(newSource, destination, filePattern, includeParentDirectory, messageContext, manager);
            }
        }
    } else if (includeParentDirectory) {
        file = manager.resolveFile(destination + File.separator + remoteFile.getName().getBaseName(),
                FileConnectorUtils.init(messageContext));
        file.createFolder();
        remoteFile.moveTo(file);
    } else {
        if (!file.exists()) {
            file.createFolder();
        }
        remoteFile.moveTo(file);
        remoteFile.createFolder();
    }
}
 
開發者ID:wso2-extensions,項目名稱:esb-connector-file,代碼行數:36,代碼來源:FileMove.java

示例15: isDirectory

private boolean isDirectory(FileObject fo) throws IOException {
  if (fo == null) return false;
  if (fo.getType() == FileType.FOLDER) {
    return true;
  } else {
    return false;
  }
}
 
開發者ID:lorthos,項目名稱:incubator-zeppelin-druid,代碼行數:8,代碼來源:VFSNotebookRepo.java


注:本文中的org.apache.commons.vfs2.FileType.FOLDER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。