Java Directory Create nio mkPath(Path nf)

Here you can find the source of mkPath(Path nf)

Description

mk Path

License

Open Source License

Declaration

private static void mkPath(Path nf) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
 * as Operator of the SLAC National Accelerator Laboratory.
 * Copyright (c) 2011 Brookhaven National Laboratory.
 * EPICS archiver appliance is distributed subject to a Software License Agreement found
 * in file LICENSE that is included with this distribution.
 *******************************************************************************/

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    private static void mkPath(Path nf) throws IOException {
        if (!Files.exists(nf)) {
            Files.createDirectories(nf.getParent());
            Files.createFile(nf);
        }/*from  w w  w  . j a  v  a 2  s.co  m*/
    }
}

Related

  1. mkdir(final File dir)
  2. mkdir(final File dir)
  3. mkdirs(Path dir, FileAttribute... attrs)
  4. mkdirs(Path path)
  5. mkdirs(Path path)