Java Path Create nio createFile(Path p)

Here you can find the source of createFile(Path p)

Description

create File

License

LGPL

Declaration

private static void createFile(Path p) 

Method Source Code

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

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import java.nio.file.Path;

public class Main {
    private static void createFile(Path p) {
        try {/*w ww . ja v  a 2  s  . c  o m*/
            PrintWriter writer = new PrintWriter(p.toString(), "UTF-8");
            writer.println(p.toString());
            writer.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. createDirIfDoesNotExist(String websitesDirPath)
  2. createEmptyResourceFile(Path path)
  3. createFile(File root, String path, String filename, String value)
  4. createFile(final Path file, final String line)
  5. createFile(Path filePath, byte[] content)
  6. createFile(Path path)
  7. createFile(Path path)
  8. createFile(Path path)
  9. createFile(Path path)