code: public static File getFileIfReadable(String _file) throws IOException {
          if (StringUtil.isBlank(_file)) {
              throw new IOException("Empty or null string is not a valid file");
          }
  
          File file = new File(_file);
  
          if (!file.exists()) {
              throw new FileNotFoundException("No such file: " + _file);
          } else if (!file.isFile()) {
              throw new IOException("Not a file: " + _file);
          } else if (!file.canRead()) {
              throw new AccessDeniedException("File not readable: " + _file);
          }
  
          return file;
      }
docs: Checks if given String is a valid file, e.g. file exists, is really a file and can be read.
  
  Throws IOException or Subclass of it, if file is either non-existing, not a file or unreadable.
  
  @param _file filename
  @return file object, never null
  @throws IOException if file could not be read