Java Is Readable File isReadableFile(final File f)

Here you can find the source of isReadableFile(final File f)

Description

is Readable File

License

Open Source License

Declaration

public static String isReadableFile(final File f) 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

import java.io.File;

public class Main {
    public static String isReadableFile(final File f) {
        if (!f.exists()) {
            return "\"" + f + "\" does not exist";
        }/*ww w .j  a  v a  2s.  c  o m*/
        if (f.isDirectory()) {
            return "\"" + f + "\" is a directory";
        }
        if (!f.isFile()) {
            return "\"" + f + "\" is not a file";
        }
        if (!f.canRead()) {
            return "cannot read from \"" + f + "\"";
        }
        if (f.length() < 1) {
            return "\"" + f + "\" appears empty";
        }
        return null;
    }
}

Related

  1. isReadableFile(File file)
  2. isReadableFile(File file)
  3. isReadableFile(File file)
  4. isReadableFile(File file)
  5. isReadableFile(File path)
  6. isReadableFile(final String filename)
  7. isReadableFile(String fileName)