Android File Create createIfNoExist(String path)

Here you can find the source of createIfNoExist(String path)

Description

create If No Exist

License

Apache License

Declaration

public static void createIfNoExist(String path) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;

public class Main {
    public static void createIfNoExist(String path) throws IOException {
        File file = new File(path);
        if (file.exists())
            return;
        if (!file.createNewFile())
            throw new IOException("Could not create file: " + path);
    }/*w w w . j av  a2s .  c  o m*/
}

Related

  1. createFile(String path, List content)
  2. createFile(String path, String content)
  3. createFile(String path, boolean isFile)
  4. createFileInFolder(File folder, String fileName)
  5. createFileInFolder(File folder, String fileName)
  6. createNewFile(File file)
  7. createNewFile(String filePath)
  8. createNewFile(String filePath)
  9. createNewFile(String filepath)