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


Java INode.isFile方法代碼示例

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


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

示例1: listStatus

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
@Override
public FileStatus[] listStatus(Path f) throws IOException {
  Path absolutePath = makeAbsolute(f);
  INode inode = store.retrieveINode(absolutePath);
  if (inode == null) {
    throw new FileNotFoundException("File " + f + " does not exist.");
  }
  if (inode.isFile()) {
    return new FileStatus[] {
        new S3FileStatus(f.makeQualified(this), inode)
    };
  }
  ArrayList<FileStatus> ret = new ArrayList<FileStatus>();
  for (Path p : store.listSubPaths(absolutePath)) {
    ret.add(getFileStatus(p.makeQualified(this)));
  }
  return ret.toArray(new FileStatus[0]);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:19,代碼來源:SmallBlockS3FileSystem.java

示例2: isFile

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
@Override
public boolean isFile(Path path) throws IOException {
  INode inode = store.retrieveINode(makeAbsolute(path));
  if (inode == null) {
    return false;
  }
  return inode.isFile();
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:9,代碼來源: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: delete

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
@Override
public boolean delete(Path path, boolean recursive) throws IOException {
  Path absolutePath = makeAbsolute(path);
  INode inode = store.retrieveINode(absolutePath);
  if (inode == null) {
    return false;
  }
  if (inode.isFile()) {
    store.deleteINode(absolutePath);
    for (Block block: inode.getBlocks()) {
      store.deleteBlock(block);
    }
  } else {
    FileStatus[] contents = null;
    try {
      contents = listStatus(absolutePath);
    } catch(FileNotFoundException fnfe) {
      return false;
    }

    if ((contents.length !=0) && (!recursive)) {
      throw new IOException("Directory " + path.toString()
          + " is not empty.");
    }
    for (FileStatus p:contents) {
      if (!delete(p.getPath(), recursive)) {
        return false;
      }
    }
    store.deleteINode(absolutePath);
  }
  return true;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:34,代碼來源:SmallBlockS3FileSystem.java

示例5: mkdir

import org.apache.hadoop.fs.s3.INode; //導入方法依賴的package包/類
private boolean mkdir(Path path) throws IOException {
  Path absolutePath = makeAbsolute(path);
  INode inode = store.retrieveINode(absolutePath);
  if (inode == null) {
    store.storeINode(absolutePath, INode.DIRECTORY_INODE);
  } else if (inode.isFile()) {
    throw new IOException(String.format(
        "Can't make directory for path %s since it is a file.",
        absolutePath));
  }
  return true;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:13,代碼來源:SmallBlockS3FileSystem.java


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