Java Path Create nio createFileIfNotExist(Path path)

Here you can find the source of createFileIfNotExist(Path path)

Description

create File If Not Exist

License

Apache License

Declaration

public static void createFileIfNotExist(Path path) throws IOException 

Method Source Code

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

import java.io.IOException;

import java.nio.channels.FileChannel;

import java.nio.file.Path;
import java.nio.file.StandardOpenOption;

public class Main {
    public static void createFileIfNotExist(Path path) throws IOException {
        try (FileChannel f = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) {
        }/*from   w w  w .ja v a 2s. c  o m*/
    }
}

Related

  1. createFile(Path path)
  2. createFile(String filePath, String content)
  3. createFile(String workspacePath)
  4. createFileForReport(Path reportDir, String filePrefix, String fileSuffix)
  5. createFileFromText(String sourceText, IPath path)
  6. createFileIfNotExists(Path path)
  7. createFileRelativeToClasspath(String resourceName)
  8. createFileWithContents(String pathString, String contents)
  9. createFolder(String workspacePath)