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


Java PathIsDirectoryException类代码示例

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


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

示例1: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory() && !deleteDirs) {
    throw new PathIsDirectoryException(item.toString());
  }

  // TODO: if the user wants the trash to be used but there is any
  // problem (ie. creating the trash dir, moving the item to be deleted,
  // etc), then the path will just be deleted because moveToTrash returns
  // false and it falls thru to fs.delete.  this doesn't seem right
  if (moveToTrash(item) || !canBeSafelyDeleted(item)) {
    return;
  }
  if (!item.fs.delete(item.path, deleteDirs)) {
    throw new PathIOException(item.toString());
  }
  out.println("Deleted " + item);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:Delete.java

示例2: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if(item.stat.isDirectory()) {
    throw new PathIsDirectoryException(item.toString());
  }
  long oldLength = item.stat.getLen();
  if(newLength > oldLength) {
    throw new IllegalArgumentException(
        "Cannot truncate to a larger file size. Current size: " + oldLength +
        ", truncate size: " + newLength + ".");
  }
  if(item.fs.truncate(item.path, newLength)) {
    out.println("Truncated " + item + " to length: " + newLength);
  }
  else if(waitOpt) {
    waitList.add(item);
  }
  else {
    out.println("Truncating " + item + " to length: " + newLength + ". " +
        "Wait for block recovery to complete before further updating this " +
        "file.");
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:Truncate.java

示例3: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    throw new PathIsDirectoryException(item.toString());
  }

  FileChecksum checksum = item.fs.getFileChecksum(item.path);
  if (checksum == null) {
    out.printf("%s\tNONE\t%n", item.toString());
  } else {
    String checksumString = StringUtils.byteToHexString(
        checksum.getBytes(), 0, checksum.getLength());
    out.printf("%s\t%s\t%s%n",
        item.toString(), checksum.getAlgorithmName(),
        checksumString);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:Display.java

示例4: processOptions

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  try {
    CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "nl",
        "skip-empty-file");
    cf.parse(args);

    delimiter = cf.getOpt("nl") ? "\n" : null;
    skipEmptyFileDelimiter = cf.getOpt("skip-empty-file");

    dst = new PathData(new URI(args.removeLast()), getConf());
    if (dst.exists && dst.stat.isDirectory()) {
      throw new PathIsDirectoryException(dst.toString());
    }
    srcs = new LinkedList<PathData>();
  } catch (URISyntaxException e) {
    throw new IOException("unexpected URISyntaxException", e);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:CopyCommands.java

示例5: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    throw new PathIsDirectoryException(item.toString());
  }

  long offset = dumpFromOffset(item, startingOffset);
  while (follow) {
    try {
      Thread.sleep(followDelay);
    } catch (InterruptedException e) {
      break;
    }
    offset = dumpFromOffset(item, offset);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:17,代码来源:Tail.java

示例6: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory() && !deleteDirs) {
    throw new PathIsDirectoryException(item.toString());
  }

  // TODO: if the user wants the trash to be used but there is any
  // problem (ie. creating the trash dir, moving the item to be deleted,
  // etc), then the path will just be deleted because moveToTrash returns
  // false and it falls thru to fs.delete.  this doesn't seem right
  if (moveToTrash(item)) {
    return;
  }
  if (!item.fs.delete(item.path, deleteDirs)) {
    throw new PathIOException(item.toString());
  }
  out.println("Deleted " + item);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:Delete.java

示例7: processOptions

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  try {
    CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "nl");
    cf.parse(args);

    delimiter = cf.getOpt("nl") ? "\n" : null;

    dst = new PathData(new URI(args.removeLast()), getConf());
    if (dst.exists && dst.stat.isDirectory()) {
      throw new PathIsDirectoryException(dst.toString());
    }
    srcs = new LinkedList<PathData>();
  } catch (URISyntaxException e) {
    throw new IOException("unexpected URISyntaxException", e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:CopyCommands.java

示例8: processPath

import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    throw new PathIsDirectoryException(item.toString());
  }

  FileChecksum checksum = item.fs.getFileChecksum(item.path);
  if (checksum == null) {
    out.printf("%s\tNONE\t\n", item.toString());
  } else {
    String checksumString = StringUtils.byteToHexString(
        checksum.getBytes(), 0, checksum.getLength());
    out.printf("%s\t%s\t%s\n",
        item.toString(), checksum.getAlgorithmName(),
        checksumString);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:18,代码来源:Display.java


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