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


Java FSUtils.create方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.FSUtils.create方法的典型用法代码示例。如果您正苦于以下问题:Java FSUtils.create方法的具体用法?Java FSUtils.create怎么用?Java FSUtils.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.FSUtils的用法示例。


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

示例1: writeSnapshotInfo

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/**
 * Write the snapshot description into the working directory of a snapshot
 * @param snapshot description of the snapshot being taken
 * @param workingDir working directory of the snapshot
 * @param fs {@link FileSystem} on which the snapshot should be taken
 * @throws IOException if we can't reach the filesystem and the file cannot be cleaned up on
 *           failure
 */
public static void writeSnapshotInfo(SnapshotDescription snapshot, Path workingDir, FileSystem fs)
    throws IOException {
  FsPermission perms = FSUtils.getFilePermissions(fs, fs.getConf(),
    HConstants.DATA_FILE_UMASK_KEY);
  Path snapshotInfo = new Path(workingDir, SnapshotDescriptionUtils.SNAPSHOTINFO_FILE);
  try {
    FSDataOutputStream out = FSUtils.create(fs, snapshotInfo, perms, true);
    try {
      snapshot.writeTo(out);
    } finally {
      out.close();
    }
  } catch (IOException e) {
    // if we get an exception, try to remove the snapshot info
    if (!fs.delete(snapshotInfo, false)) {
      String msg = "Couldn't delete snapshot info file: " + snapshotInfo;
      LOG.error(msg);
      throw new IOException(msg);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:SnapshotDescriptionUtils.java

示例2: writeRegionInfoFileContent

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/**
 * Write the .regioninfo file on-disk.
 */
private static void writeRegionInfoFileContent(final Configuration conf, final FileSystem fs,
    final Path regionInfoFile, final byte[] content) throws IOException {
  // First check to get the permissions
  FsPermission perms = FSUtils.getFilePermissions(fs, conf, HConstants.DATA_FILE_UMASK_KEY);
  // Write the RegionInfo file content
  FSDataOutputStream out = FSUtils.create(conf, fs, regionInfoFile, perms, null);
  try {
    out.write(content);
  } finally {
    out.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:HRegionFileSystem.java

示例3: createOutputStream

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/** A helper method to create HFile output streams in constructors */
protected static FSDataOutputStream createOutputStream(Configuration conf,
    FileSystem fs, Path path, InetSocketAddress[] favoredNodes) throws IOException {
  FsPermission perms = FSUtils.getFilePermissions(fs, conf,
      HConstants.DATA_FILE_UMASK_KEY);
  return FSUtils.create(conf, fs, path, perms, favoredNodes);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:AbstractHFileWriter.java


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