Java Utililty Methods Is Readable File

List of utility methods to do Is Readable File

Description

The list of methods to do Is Readable File are organized into topic(s).

Method

booleanisReachable(String internetProtocolAddress)
is Reachable
List<String> command = new ArrayList<String>();
command.add("ping");
if (System.getProperty("os.name").startsWith("Windows"))
    command.add("-n");
} else {
    command.add("-c");
command.add("1");
command.add(internetProtocolAddress);
ProcessBuilder processBuilder = new ProcessBuilder(command);
Process process = processBuilder.start();
BufferedReader standardOutput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String outputLine;
while ((outputLine = standardOutput.readLine()) != null) {
    if (outputLine.toLowerCase().contains("destination host unreachable")) {
        return false;
return true;
voidisReadable(File arcFile)
is Readable
if (!arcFile.exists()) {
    throw new FileNotFoundException(arcFile.getAbsolutePath() + " does not exist.");
if (!arcFile.canRead()) {
    throw new FileNotFoundException(arcFile.getAbsolutePath() + " is not readable.");
booleanisReadable(String filename)
Determine if the given filename exists and is readable.
if (filename == null) {
    return false;
File file = new File(filename);
return file.exists() && file.canRead();
booleanisReadableFile(File f)
is Readable File
String msg;
if (!f.exists()) {
    msg = "Cannot find file: " + f;
    log.warn(msg);
    return false;
if (!f.canRead()) {
    msg = "Cannot read from file: " + f;
...
booleanisReadableFile(File file)
Returns whether the given file is non-null, a plain file and is readable.
return file != null && file.isFile() && file.canRead();
booleanisReadableFile(File file)
Check the file can read or not
return file != null && file.exists() && file.isFile() && file.canRead();
booleanisReadableFile(File file)
is Readable File
try {
    return file != null && file.exists() && file.isFile() && file.canRead();
} catch (SecurityException se) {
    se.printStackTrace(System.err);
    return false;
booleanisReadableFile(File file)
Check if the passed File point to an existing file and can be read by the user.
boolean state = true;
if (!file.exists() || !file.isFile()) {
    System.err.println(String.format("%s: does not exist", file.getName()));
    state = false;
} else if (!file.canRead()) {
    System.err.println(String.format("%s: no read permission", file.getName()));
    state = false;
return state;
booleanisReadableFile(File path)
Returns true if the specified path represents a readable file, false otherwise.
return path.isFile() && path.canRead();
StringisReadableFile(final File f)
is Readable File
if (!f.exists()) {
    return "\"" + f + "\" does not exist";
if (f.isDirectory()) {
    return "\"" + f + "\" is a directory";
if (!f.isFile()) {
    return "\"" + f + "\" is not a file";
...