code: @Override
      public boolean exists() {
          // Try file existence: can we find the file in the file system?
          try {
              return getFile().exists();
          }
          catch (IoRuntimeException ex) {
              // Fall back to stream existence: can we open the stream?
              try {
                  try (InputStream is = getInputStream()) {
                  	return true;
                  }
              }
              catch (Throwable isEx) {
                  return false;
              }
          }
      }
docs: This implementation checks whether a File can be opened,
  falling back to whether an InputStream can be opened.
  This will cover both directories and content resources.