code: public static boolean isFile(Resource resource) {
          Node node = resource.adaptTo(Node.class);
          if (node != null) {
              try {
                  NodeType type = node.getPrimaryNodeType();
                  if (type != null) {
                      String typeName = type.getName();
                      switch (typeName) {
                          case TYPE_FILE:
                              return true;
                          case TYPE_RESOURCE:
                          case TYPE_UNSTRUCTURED:
                              try {
                                  Property mimeType = node.getProperty(PROP_MIME_TYPE);
                                  if (mimeType != null && StringUtils.isNotBlank(mimeType.getString())) {
                                      node.getProperty(ResourceUtil.PROP_DATA);
                                      // PathNotFountException if not present
                                      return true;
                                  }
                              } catch (PathNotFoundException pnfex) {
                                  // ok, was a check only
                              }
                              break;
                      }
                  }
              } catch (RepositoryException e) {
                  LOG.error(e.getMessage(), e);
              }
          }
          return false;
      }
docs: Returns 'true' is this resource represents a 'file'.