Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

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

Prototype

String separator

To view the source code for java.io File separator.

Click Source Link

Document

The system-dependent default name-separator character, represented as a string for convenience.

Usage

From source file:Main.java

public static File getDataFileSoPatchForInstall(Context base) {
    File dir = new File(base.getFilesDir().getAbsolutePath() + File.separator + "rocoolib" + File.separator);
    if (!dir.exists()) {
        dir.mkdirs();//from   w  ww.  ja v  a  2  s  .  c  o m
    }
    return dir;
}

From source file:Main.java

private static String pathForCacheEntry(String name) {
    return BASE_CACHE_PATH + File.separator + name + FILE_SUFFIX;
}

From source file:Main.java

public static String getClassFile(String name) {
    StringBuffer sb = new StringBuffer(name);
    name = name.replace('.', File.separatorChar) + ".class";
    sb.append(File.separator + name);
    return sb.toString();
}

From source file:Main.java

public static String getNetDiskPath(String path, String name) {
    if (path == null || name == null)
        return null;
    if (path.equals("")) {
        return name;
    }/*from w ww . ja  v a2s  .c o  m*/
    return path + File.separator + name;
}

From source file:Main.java

public static String getFilePath(File dirPath, String fileName) {
    try {/*from  ww  w.  ja  v a 2  s.  c  o  m*/
        String filePath = dirPath.getAbsolutePath() + File.separator
                + URLEncoder.encode(fileName.replace("*", ""), "UTF-8");
        return filePath;
    } catch (final UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    return null;

}

From source file:Main.java

public static String getBooKName(String textPath) {
    if (textPath == null || "".equalsIgnoreCase(textPath) || textPath.startsWith(".")) {
        return "";
    }/*w ww .  j a  v a 2 s  .  c om*/
    return textPath.substring(textPath.lastIndexOf(File.separator) + 1);
}

From source file:Main.java

private static String getClassFullName(String packagePath) {
    return packagePath.replace(File.separator, DOT).replace(EXT, BLANK_STR);
}

From source file:Main.java

@SuppressWarnings("WeakerAccess")
public static String getPathForFile(final String filename) {
    return (getPathForSharedStorage() + File.separator + filename);
}

From source file:Main.java

public static void copyToSD(InputStream in, String fileName) {
    String path = Environment.getExternalStorageDirectory() + File.separator + fileName;
    File file = new File(path);
    try {//from  w  ww.  j  a va  2 s .  c o  m
        FileOutputStream fos = new FileOutputStream(file);
        byte[] buffer = new byte[1024];
        int len = 0;
        while ((len = in.read(buffer)) != -1) {
            fos.write(buffer, 0, len);
        }
        fos.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static final String getContentImagePath(String fileName) {
    String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
            + CONTENTS_FOLDER_NAME + File.separator + "Images" + File.separator + fileName;
    return path;// www. ja  v a  2s  .  c o  m
}