• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PathIsDirectoryException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Keymap类代码示例发布时间:2022-05-22
下一篇:
Java ObjectIntMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap