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


Java INode.isDirectory方法代碼示例

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


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

示例1: renameRecursive

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
private boolean renameRecursive(Path src, Path dst) throws IOException {
  INode srcINode = store.retrieveINode(src);
  store.storeINode(dst, srcINode);
  store.deleteINode(src);
  if (srcINode.isDirectory()) {
    for (Path oldSrc : store.listDeepSubPaths(src)) {
      INode inode = store.retrieveINode(oldSrc);
      if (inode == null) {
        return false;
      }
      String oldSrcPath = oldSrc.toUri().getPath();
      String srcPath = src.toUri().getPath();
      String dstPath = dst.toUri().getPath();
      Path newDst = new Path(oldSrcPath.replaceFirst(srcPath, dstPath));
      store.storeINode(newDst, inode);
      store.deleteINode(oldSrc);
    }
  }
  return true;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:21,代碼來源:SmallBlockS3FileSystem.java

示例2: checkFile

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
private INode checkFile(Path path) throws IOException {
  INode inode = store.retrieveINode(makeAbsolute(path));
  if (inode == null) {
    throw new IOException("No such file.");
  }
  if (inode.isDirectory()) {
    throw new IOException("Path " + path + " is a directory.");
  }
  return inode;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:11,代碼來源:SmallBlockS3FileSystem.java

示例3: rename

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
@Override
public boolean rename(Path src, Path dst) throws IOException {
  Path absoluteSrc = makeAbsolute(src);
  INode srcINode = store.retrieveINode(absoluteSrc);
  if (srcINode == null) {
    // src path doesn't exist
    return false;
  }
  Path absoluteDst = makeAbsolute(dst);
  INode dstINode = store.retrieveINode(absoluteDst);
  if (dstINode != null && dstINode.isDirectory()) {
    absoluteDst = new Path(absoluteDst, absoluteSrc.getName());
    dstINode = store.retrieveINode(absoluteDst);
  }
  if (dstINode != null) {
    // dst path already exists - can't overwrite
    return false;
  }
  Path dstParent = absoluteDst.getParent();
  if (dstParent != null) {
    INode dstParentINode = store.retrieveINode(dstParent);
    if (dstParentINode == null || dstParentINode.isFile()) {
      // dst parent doesn't exist or is a file
      return false;
    }
  }
  return renameRecursive(absoluteSrc, absoluteDst);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:29,代碼來源:SmallBlockS3FileSystem.java

示例4: findLength

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
private static long findLength(INode inode) {
  if (!inode.isDirectory()) {
    long length = 0L;
    for (Block block : inode.getBlocks()) {
      length += block.getLength();
    }
    return length;
  }
  return 0;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:11,代碼來源:SmallBlockS3FileSystem.java

示例5: S3FileStatus

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
S3FileStatus(Path f, INode inode) throws IOException {
  super(findLength(inode), inode.isDirectory(), 1,
      findBlocksize(inode), 0, f);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:5,代碼來源:SmallBlockS3FileSystem.java


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