Example usage for org.apache.hadoop.fs AbstractFileSystem getFileStatus

List of usage examples for org.apache.hadoop.fs AbstractFileSystem getFileStatus

Introduction

In this page you can find the example usage for org.apache.hadoop.fs AbstractFileSystem getFileStatus.

Prototype

public abstract FileStatus getFileStatus(final Path f)
        throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException;

Source Link

Document

The specification of this method matches that of FileContext#getFileStatus(Path) except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.

Usage

From source file:org.apache.ignite.igfs.HadoopIgfs20FileSystemAbstractSelfTest.java

License:Apache License

/**
 * Assert that a given path exists in a given FileSystem.
 *
 * @param fs FileSystem to check.//from ww w.  j  av a2 s  .  c om
 * @param p Path to check.
 * @throws IOException if the path does not exist.
 */
private void assertPathExists(AbstractFileSystem fs, Path p) throws IOException {
    FileStatus fileStatus = fs.getFileStatus(p);

    assertEquals(p, fileStatus.getPath());
    assertNotSame(0, fileStatus.getModificationTime());
}

From source file:org.apache.ignite.igfs.HadoopIgfs20FileSystemAbstractSelfTest.java

License:Apache License

/**
 * Check path does not exist in a given FileSystem.
 *
 * @param fs FileSystem to check.//from w  ww  .  ja v a 2s  .  c  o  m
 * @param path Path to check.
 */
private void assertPathDoesNotExist(final AbstractFileSystem fs, final Path path) {
    GridTestUtils.assertThrows(log, new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            return fs.getFileStatus(path);
        }
    }, FileNotFoundException.class, null);
}