Java Path File Check nio isRegularUsable(final Path pathToFile, final LinkOption... linkOption)

Here you can find the source of isRegularUsable(final Path pathToFile, final LinkOption... linkOption)

Description

Return whether the file detonated by the Path Path pathToFile is existing, a regular file and readable.

License

Open Source License

Parameter

Parameter Description
pathToFile The
linkOption a parameter

Declaration

public static boolean isRegularUsable(final Path pathToFile, final LinkOption... linkOption) 

Method Source Code

//package com.java2s;
/* Copyright (c) 2013 Tim Langhammer, All Rights Reserved
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 * <p/>//  w w w .j  a  v  a2  s. c  o m
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.  
 */

import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;

public class Main {
    /**
     * Return whether the file detonated by the
     * {@link Path Path} {@code pathToFile}
     * is existing, a <em>regular</em> file and readable.
     * <p>
     * @see java.nio.file.Files#isRegularFile(java.nio.file.Path,
     * java.nio.file.LinkOption[])
     * @see java.nio.file.Files#isReadable(java.nio.file.Path)
     * @param pathToFile The
     * @param linkOption
     * @return
     */
    public static boolean isRegularUsable(final Path pathToFile, final LinkOption... linkOption) {
        return Files.exists(pathToFile, linkOption) && Files.isRegularFile(pathToFile, linkOption)
                && Files.isReadable(pathToFile);
    }
}

Related

  1. isParent(Path parent, Path path)
  2. isParentOf(Path possibleParent, Path possibleChild)
  3. isPath(Class clazz)
  4. isPermission(Path p, Function function)
  5. isPictureFile(Path file)
  6. isSame(Path expected, Path actual)
  7. isSameFile(Path path1, Path path2)
  8. isSteadyStateReached(Path integrationStepFile, double minStepAtEndOfStabilization)
  9. isUNC(Path inputPath)