org.apache.hadoop.io.nativeio.NativeIO.getShareDeleteFileInputStream()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.apache.hadoop.io.nativeio.NativeIO.getShareDeleteFileInputStream()方法的一些代码示例,展示了NativeIO.getShareDeleteFileInputStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NativeIO.getShareDeleteFileInputStream()方法的具体详情如下:
包路径:org.apache.hadoop.io.nativeio.NativeIO
类名称:NativeIO
方法名:getShareDeleteFileInputStream

NativeIO.getShareDeleteFileInputStream介绍

[英]Create a FileInputStream that shares delete permission on the file opened, i.e. other process can delete the file the FileInputStream is reading. Only Windows implementation uses the native interface.
[中]创建一个FileInputStream,共享对打开文件的删除权限,即其他进程可以删除FileInputStream正在读取的文件。只有Windows实现使用本机接口。

代码示例

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Override // FsDatasetSpi
public InputStream getBlockInputStream(ExtendedBlock b,
  long seekOffset) throws IOException {
 File blockFile = getBlockFileNoExistsCheck(b, true);
 if (isNativeIOAvailable) {
  return NativeIO.getShareDeleteFileInputStream(blockFile, seekOffset);
 } else {
  try {
   return openAndSeek(blockFile, seekOffset);
  } catch (FileNotFoundException fnfe) {
   throw new IOException("Block " + b + " is not valid. " +
     "Expected block file at " + blockFile + " does not exist.");
  }
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override // FsDatasetSpi
public InputStream getBlockInputStream(ExtendedBlock b,
  long seekOffset) throws IOException {
 File blockFile = getBlockFileNoExistsCheck(b, true);
 if (isNativeIOAvailable) {
  return NativeIO.getShareDeleteFileInputStream(blockFile, seekOffset);
 } else {
  try {
   return openAndSeek(blockFile, seekOffset);
  } catch (FileNotFoundException fnfe) {
   throw new IOException("Block " + b + " is not valid. " +
     "Expected block file at " + blockFile + " does not exist.");
  }
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Override // FsDatasetSpi
public LengthInputStream getMetaDataInputStream(ExtendedBlock b)
  throws IOException {
 File meta = FsDatasetUtil.getMetaFile(getBlockFile(b), b.getGenerationStamp());
 if (meta == null || !meta.exists()) {
  return null;
 }
 if (isNativeIOAvailable) {
  return new LengthInputStream(
    NativeIO.getShareDeleteFileInputStream(meta),
    meta.length());
 }
 return new LengthInputStream(new FileInputStream(meta), meta.length());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override // FsDatasetSpi
public LengthInputStream getMetaDataInputStream(ExtendedBlock b)
  throws IOException {
 File meta = FsDatasetUtil.getMetaFile(getBlockFile(b), b.getGenerationStamp());
 if (meta == null || !meta.exists()) {
  return null;
 }
 if (isNativeIOAvailable) {
  return new LengthInputStream(
    NativeIO.getShareDeleteFileInputStream(meta),
    meta.length());
 }
 return new LengthInputStream(new FileInputStream(meta), meta.length());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

NativeIO.getShareDeleteFileInputStream(blockFile) :
new FileInputStream(blockFile)) {

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

NativeIO.getShareDeleteFileInputStream(blockFile) :
new FileInputStream(blockFile)) {

相关文章