Example usage for java.io File getAbsolutePath

List of usage examples for java.io File getAbsolutePath

Introduction

In this page you can find the example usage for java.io File getAbsolutePath.

Prototype

public String getAbsolutePath() 

Source Link

Document

Returns the absolute pathname string of this abstract pathname.

Usage

From source file:Main.java

public static boolean isRoot(File dir) {

    return dir.getAbsolutePath().equals("/");
}

From source file:Main.java

static private String getRelName(String from, File file) {
    String a = file.getAbsolutePath().replace(from + "\\", "");
    a = a.replace("\\", "/");
    return a;//  w ww.  ja v a  2  s .co m
}

From source file:Main.java

private static String root() {
    File f = new File("");
    return f.getAbsolutePath();
}

From source file:Main.java

private static boolean isEqualPath(File file1, File file2) {
    return file1.getAbsolutePath().equals(file2.getAbsolutePath());
}

From source file:Main.java

public static void makeDirectoryOnly(File file) {
    String[] partial = file.getAbsolutePath().split("/");
    String path = "/";
    for (int i = 0; i < partial.length - 1; ++i) {
        path += partial[i] + '/';
    }//from   ww w.  ja va 2 s.  c  o  m
    new File(path).mkdirs();
}

From source file:Main.java

public static String getETag(File file) {
    return Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()).hashCode());
}

From source file:Main.java

private static String getDirectory(String fileName) {
    File file = new File(fileName);
    return file.getAbsolutePath();
}

From source file:Main.java

public static final String getAbsolutePath(final File file) {
    return file != null ? file.getAbsolutePath() : null;
}

From source file:Main.java

public static String getMimeType(File file) {
    return getMimeType(file.getAbsolutePath());
}

From source file:Main.java

public static String getSharePicName(File cacheFile, String[] urls) {
    return cacheFile.getAbsolutePath() + new Random().nextInt(100000) + "." + urls[urls.length - 1];
}