Java 类org.apache.hadoop.io.nativeio.NativeIO.POSIX.Stat 实例源码

项目:hadoop-oss    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop-oss    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop-oss    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hadoop    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:big-c    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:big-c    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:big-c    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hadoop-plus    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop-plus    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop-plus    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hops    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hops    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hops    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hadoop-TCP    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop-TCP    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop-TCP    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hardfs    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hardfs    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hardfs    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}
项目:hadoop-on-lustre2    文件:SecureIOUtils.java   
/**
 * Same as openForRandomRead except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static RandomAccessFile forceSecureOpenForRandomRead(File f,
    String mode, String expectedOwner, String expectedGroup)
    throws IOException {
  RandomAccessFile raf = new RandomAccessFile(f, mode);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(raf.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return raf;
  } finally {
    if (!success) {
      raf.close();
    }
  }
}
项目:hadoop-on-lustre2    文件:SecureIOUtils.java   
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
项目:hadoop-on-lustre2    文件:SecureIOUtils.java   
/**
 * Same as openForRead() except that it will run even if security is off.
 * This is used by unit tests.
 */
@VisibleForTesting
protected static FileInputStream forceSecureOpenForRead(File f, String expectedOwner,
    String expectedGroup) throws IOException {

  FileInputStream fis = new FileInputStream(f);
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(fis.getFD());
    checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return fis;
  } finally {
    if (!success) {
      fis.close();
    }
  }
}