Android File Create createNewFile(String filepath)

Here you can find the source of createNewFile(String filepath)

Description

create New File

Declaration

public static File createNewFile(String filepath) throws IOException 

Method Source Code

//package com.java2s;

import java.io.File;

import java.io.IOException;

public class Main {
    public static File createNewFile(String filepath) throws IOException {
        return createNewFile(new File(filepath));
    }/*w  w w  .  j  a v  a 2s . c o m*/

    /**
     * create a new blank file
     * @param file
     * @return
     * @throws IOException
     */
    public static File createNewFile(File file) throws IOException {
        File pareFile = file.getParentFile();
        if (pareFile.exists() || pareFile.mkdirs()) {
            File newFile = file;
            if (newFile.exists() || newFile.createNewFile())
                return newFile;
        }
        return null;
    }
}

Related

  1. createFileInFolder(File folder, String fileName)
  2. createIfNoExist(String path)
  3. createNewFile(File file)
  4. createNewFile(String filePath)
  5. createNewFile(String filePath)
  6. createNewFileOnExist(String filePath)
  7. createSequenceFileName(String prefix, int sequenceNumber, int padTo, String suffix)
  8. ensureWorldReadable(File f)
  9. ensureWorldWriteable(File f)