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

Java PathExistsException类代码示例

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

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



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

示例1: processArguments

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:22,代码来源:CommandWithDestination.java


示例2: copyStreamToTarget

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
/**
 * If direct write is disabled ,copies the stream contents to a temporary
 * file "<target>._COPYING_". If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * if direct write is enabled , then creation temporary file is skipped.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = direct ? target : target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist, direct);
    if (!direct) {
      targetFs.rename(tempTarget, target);
    }
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:28,代码来源:CommandWithDestination.java


示例3: copyStreamToTarget

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:CommandWithDestination.java


示例4: copyStreamToTarget

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:CommandWithDestination.java


示例5: processArguments

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString())
        .withFullyQualifiedPath(dst.path.toUri().toString());
  }
  super.processArguments(args);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:CommandWithDestination.java


示例6: processPath

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  String srcUri = src.fs.getUri().getScheme() + "://" +
      src.fs.getUri().getHost();
  String dstUri = target.fs.getUri().getScheme() + "://" +
      target.fs.getUri().getHost();
  if (!srcUri.equals(dstUri)) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:MoveCommands.java


示例7: processPath

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:MoveCommands.java


示例8: processPath

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:11,代码来源:Mkdir.java


示例9: cast

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
/**
 * Cast IO exception to IGFS exception.
 *
 * @param msg Error message.
 * @param e IO exception.
 * @return IGFS exception.
 */
public static IgfsException cast(String msg, IOException e) {
    if (e instanceof FileNotFoundException)
        return new IgfsPathNotFoundException(e);
    else if (e instanceof ParentNotDirectoryException)
        return new IgfsParentNotDirectoryException(msg, e);
    else if (e instanceof PathIsNotEmptyDirectoryException)
        return new IgfsDirectoryNotEmptyException(e);
    else if (e instanceof PathExistsException)
        return new IgfsPathAlreadyExistsException(msg, e);
    else
        return new IgfsException(msg, e);
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:HadoopIgfsSecondaryFileSystemDelegateImpl.java


示例10: testCreateCheckOverwrite

import org.apache.hadoop.fs.PathExistsException; //导入依赖的package包/类
/** @throws Exception If failed. */
public void testCreateCheckOverwrite() throws Exception {
    Path fsHome = new Path(primaryFsUri);
    Path dir = new Path(fsHome, "/someDir1/someDir2/someDir3");
    final Path file = new Path(dir, "someFile");

    FSDataOutputStream out = fs.create(file, EnumSet.noneOf(CreateFlag.class),
        Options.CreateOpts.perms(FsPermission.getDefault()));

    out.close();

    // Check intermediate directory permissions.
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir).getPermission());
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir.getParent()).getPermission());
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir.getParent().getParent()).getPermission());

    GridTestUtils.assertThrows(log, new Callable<Object>() {
        @Override public Object call() throws Exception {
            return fs.create(file, EnumSet.noneOf(CreateFlag.class),
                Options.CreateOpts.perms(FsPermission.getDefault()));
        }
    }, PathExistsException.class, null);

    // Overwrite should be successful.
    FSDataOutputStream out1 = fs.create(file, EnumSet.of(CreateFlag.OVERWRITE),
        Options.CreateOpts.perms(FsPermission.getDefault()));

    out1.close();
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:HadoopIgfs20FileSystemAbstractSelfTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java TorInitializationListener类代码示例发布时间:2022-05-22
下一篇:
Java ThrowStmt类代码示例发布时间: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