Android Utililty Methods File Create

List of utility methods to do File Create

Description

The list of methods to do File Create are organized into topic(s).

Method

voidcreateFile(String path, boolean isFile)
create File
createFile(new File(path), isFile);
FilecreateFileInFolder(File folder, String fileName)
create File In Folder
File file = removeableFile(folder, fileName);
file.createNewFile();
return file;
FilecreateFileInFolder(File folder, String fileName)
create File In Folder
File file = new File(folder, fileName);
file.createNewFile();
file.deleteOnExit();
return file;
voidcreateIfNoExist(String path)
create If No Exist
File file = new File(path);
if (file.exists())
    return;
if (!file.createNewFile())
    throw new IOException("Could not create file: " + path);
FilecreateNewFile(File file)
create a new blank file
File pareFile = file.getParentFile();
if (pareFile.exists() || pareFile.mkdirs()) {
    File newFile = file;
    if (newFile.exists() || newFile.createNewFile())
        return newFile;
return null;
FilecreateNewFile(String filePath)
create New File
File file = new File(filePath);
if (file.exists())
    return file;
File dir = file.getParentFile();
if (!dir.exists())
    dir.mkdirs();
try {
    file.createNewFile();
...
voidcreateNewFile(String filePath)
create New File
File file = new File(filePath);
try {
    file.createNewFile();
} catch (IOException e) {
    e.printStackTrace();
FilecreateNewFile(String filepath)
create New File
return createNewFile(new File(filepath));
FilecreateNewFileOnExist(String filePath)
create New File On Exist
File file = new File(filePath);
if (file.exists())
    file.delete();
File dir = file.getParentFile();
if (!dir.exists())
    dir.mkdirs();
try {
    file.createNewFile();
...
StringcreateSequenceFileName(String prefix, int sequenceNumber, int padTo, String suffix)
create Sequence File Name
return prefix + paddedInt(sequenceNumber, padTo) + suffix;