Here you can find the source of isRegularUsable(final Path pathToFile, final LinkOption... linkOption)
Parameter | Description |
---|---|
pathToFile | The |
linkOption | a parameter |
public static boolean isRegularUsable(final Path pathToFile, final LinkOption... linkOption)
//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); } }