Android Path Create fileDir(String filename)

Here you can find the source of fileDir(String filename)

Description

file Dir

Declaration

public static String fileDir(String filename) 

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{
    /*  ww w  .  ja  v a  2s.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 folder, String folderName)
  3. getAbsoluteFile(String filename, String basedir)
  4. getAbsolutePath(String strCurrenDir, String strFileName)
  5. getAbsolutePathFromResource(Class reference, String resource)