org.linkedin.util-core/src/main/java/org/linkedin/util/io/resource/FileResource.java
public static Resource createFromRoot(File rootFile)
  {
    File root = rootFile;
    String path = "/";

    if(!root.isDirectory())
    {
      root = rootFile.getParentFile();
      path = rootFile.getName();
    }

    return create(root, path);
  }
public static Resource createFromRoot(File rootFile)
  {
    File root = rootFile;
    String path = "/";

    if(!root.isDirectory())
    {
      root = rootFile.getParentFile();
      path = rootFile.getName();
    }

    return create(root, path);
  }
Creates a file resource from a file, with the root as this file (if it is a directory
otherwise its parent).

@param rootFile the root file
@return the resource (points to this file)