Android Path Create fileDir(String folder, String folderName)

Here you can find the source of fileDir(String folder, String folderName)

Description

file Dir

Declaration

public static String fileDir(String folder, String folderName) 

Method Source Code

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;

public class Main{
    /* w  w  w  .  java 2 s  .c o m*/
    public static String fileDir(String folder, String folderName) {
        String path = null;
        if (!FileUtil.isFileExist(folder, folderName)) {
            String fullPath = folder + folderName;
            File f = new File(fullPath);
            f.mkdir();
            path = f.getPath();
        }
        return path;
    }
    
    public static String fileDir(String filename) {
        String path = null;
        if (!FileUtil.isFileExist(filename)) {

            File f = new File(filename);
            f.mkdir();
            path = f.getPath();
        }
        return path;
    }
    
    public static boolean isFileExist(String folder, String fileName) {
        boolean bool = false;
        bool = new File(folder, fileName).exists();
        return bool;
    }
    
    public static boolean isFileExist(String fileName) {
        boolean bool = false;
        bool = new File(fileName).exists();
        return bool;
    }
}

Related

  1. ensureSlash(String dirPath)
  2. fileDir(String filename)
  3. getAbsoluteFile(String filename, String basedir)
  4. getAbsolutePath(String strCurrenDir, String strFileName)
  5. getAbsolutePathFromResource(Class reference, String resource)
  6. getAbsolutePathFromResource(String resource)