public static Resource create(File file)
  {
    try
    {
      String path = file.getCanonicalPath();
      if(file.isDirectory())
        path = PathUtils.addTrailingSlash(path);
      return create(new File("/"), path);
    }
    catch(IOException e)
    {
      throw new IllegalArgumentException("invalid file " + file, e);
    }
  }
public static Resource create(File file)
  {
    try
    {
      String path = file.getCanonicalPath();
      if(file.isDirectory())
        path = PathUtils.addTrailingSlash(path);
      return create(new File("/"), path);
    }
    catch(IOException e)
    {
      throw new IllegalArgumentException("invalid file " + file, e);
    }
  }
public static Resource create ( File file ) { try { String path = file . getCanonicalPath ( ) ; if ( file . isDirectory ( ) ) path = PathUtils . addTrailingSlash ( path ) ; return create ( new File ( "/" ) , path ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( "invalid file " + file , e ) ; } }
Creates a file resource from a file

@param file the file
@return the resource (points to this file)
Creates a file resource from a file