org.apache.hadoop.io.nativeio.NativeIO#getShareDeleteFileInputStream ( )源码实例Demo

下面列出了org.apache.hadoop.io.nativeio.NativeIO#getShareDeleteFileInputStream ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hadoop   文件: FsDatasetImpl.java
@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());
}
 
源代码2 项目: hadoop   文件: FsDatasetImpl.java
@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.");
    }
  }
}
 
源代码3 项目: big-c   文件: FsDatasetImpl.java
@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());
}
 
源代码4 项目: big-c   文件: FsDatasetImpl.java
@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.");
    }
  }
}