{@inheritDoc}

@see java.nio.file.spi.FileSystemProvider#createDirectory(java.nio.file.Path,
java.nio.file.attribute.FileAttribute<?>[])
332843
@Override
    public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws IOException {
        final Archive<?> archive = this.getArchive(dir);
        final ArchivePath parent = ArchivePaths.create(dir.toString()).getParent();
        if (parent != null && !archive.contains(parent)) {
            // IOException? Despite being a stupid choice for this, it's what the NIO.2 API uses.
            throw new IOException("Cannot recursively create parent directories for: " + dir
                + "; instead invoke \"createDirectories\"");
        }
        archive.addAsDirectories(dir.toString());
        if (log.isLoggable(Level.FINEST)) {
            log.finest("Created directory " + dir.toString() + " on " + archive.toString());
        }
    }
26595
public static File newFile(String path, String content) throws FileAlreadyExistsException {
        File file = new File(path);
        boolean created;
        try {
            created = file.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        if (!created) {
            throw new FileAlreadyExistsException("Failed to create'" + path + "'. May be file already exists!");
        }
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
            writer.write(content);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return file;
    }
901938
public static String createDirectoryPath(String source)
    {
       if (tc.isEntryEnabled()) Tr.entry(tc, "createDirectoryPath",source);

       String directoryPath = null;

       if (source != null)
       {
           directoryPath = "";

           final StringTokenizer tokenizer = new StringTokenizer(source,"\\/");

           while (tokenizer.hasMoreTokens())
           {
             final String pathChunk = tokenizer.nextToken();

             directoryPath += pathChunk;

             if (tokenizer.hasMoreTokens())
             {
               directoryPath += File.separator;
             }

           }
       }

       if (tc.isEntryEnabled()) Tr.exit(tc, "createDirectoryPath",directoryPath);
       return directoryPath;
    }
828644
public WritableByteChannel create(URI path) throws IOException {
    logger.atFine().log("create(%s)", path);
    return create(path, CreateFileOptions.DEFAULT);
  }
610251
@SuppressWarnings("static-method")
	protected File createTempDirectory() {
		final File tmpPath = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
		int i = 0;
		File tmp = new File(tmpPath, "sarlc" + i); //$NON-NLS-1$
		while (tmp.exists()) {
			++i;
			tmp = new File(tmpPath, "sarlc" + i); //$NON-NLS-1$
		}
		return tmp;
	}
507967
public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
    {
        return getDefault().provider().newFileSystem(path, env);
    }
620143
public static void createDirectory(File location) throws IOException {
    if (!(location.exists() || location.mkdirs() || location.isDirectory())) {
      throw new IOException("Could not create directory at " + location);
    }
  }
1092244
public static void createDirectory(Path dir, String dirDesc)
    {
        try
        {
            Files.createDirectories(dir);
        }
        catch (IOException ex)
        {
            throw new WindupException("Error creating " + dirDesc + " folder: " + dir.toString() + " due to: " + ex.getMessage(), ex);
        }
    }
966629
public static Optional<Path> createDirectories(Path dirPath,
            FileAttribute<?>... attrs) {
        debug(log, "createDirectories", dirPath, attrs);
        try {
            return Optional.of(Files.createDirectories(dirPath, attrs));
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnEmptyOptional(log,
                    e, "createDirectories", dirPath);
        }
    }
33905
public static FileCreationState newDirectory(final File dir)
	{
		FileCreationState fileCreationState = FileCreationState.ALREADY_EXISTS;
		// If the directory does not exists
		if (!dir.exists())
		{ // then
			fileCreationState = FileCreationState.FAILED;
			// create it...
			if (dir.mkdir())
			{
				fileCreationState = FileCreationState.CREATED;
			}
		}
		return fileCreationState;
	}
942341
static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException {

		final Path sourcePath = Paths.get(sourceDirectory.toURI()).toRealPath();
		final Path targetPath = Paths.get(targetDirectory.toURI());

		Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() {
			@Override
			public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
				Path relative = sourcePath.relativize(dir);
				Path target = targetPath.resolve(relative);
				File folder = target.toFile();
				if (!folder.exists()) {
					mkdirs(folder);
				}
				return FileVisitResult.CONTINUE;
			}

			@Override
			public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
				Path relative = sourcePath.relativize(file);
				Path target = targetPath.resolve(relative);
				Files.copy(file, target, StandardCopyOption.COPY_ATTRIBUTES);
				return FileVisitResult.CONTINUE;
			}
		});
	}
774268
@Override
    public List<FileSource> createSources(String srcName) {
        final File dirOrFile = new File(srcName);

        final File[] files = dirOrFile.listFiles(FILTER);
        if (files != null) {
            final List<FileSource> sources = new ArrayList<FileSource>(files.length);
            for (File file : files) {
                sources.add(new FileSource(file));
            }
            return sources;
        } else {
            return Util.list(new FileSource(dirOrFile));
        }
    }
740872
function createDirectory(directory) {
  if (!directory) {
    throw new Error('A directory must be passed to be created.');
  }
  const statObject = getStatObject(directory);
  if (statObject && statObject.isFile()) {
    throw new Error(`The directory to create '${directory}' is a file.`);
  }
  fse.ensureDirSync(directory);
}
363982
public static void createDirectories(final String directory) {
        if (directory == null) return;
        final File f = new File(directory);
        if (!f.isDirectory()) {
            if (!f.mkdirs()) throw new RuntimeException("couldn't create "
                    + directory);
        }
    }
793338
static FileWriter createOrGetFile(File folder, String name) throws IOException {
		File file = new File(folder, name + ".json");
		if (!file.exists()) {
			Files.createFile(file.toPath());
		}
		FileWriter fr = new FileWriter(file);
		return fr;
	}
1293963
public static void copy( Path fileOrDirectory, Path toDir )
  {
    Path copy = PathUtil.create( toDir, PathUtil.getName( fileOrDirectory ) );
    if( PathUtil.isDirectory( fileOrDirectory ) )
    {
      //noinspection ResultOfMethodCallIgnored
      try
      {
        PathUtil.mkdir( copy );
        Files.list( fileOrDirectory ).forEach( child -> copy( child, copy ) );
      }
      catch( IOException e )
      {
        throw new RuntimeException( e );
      }
    }
    else
    {
      //noinspection ResultOfMethodCallIgnored
      try( InputStream is = new BufferedInputStream( Files.newInputStream( fileOrDirectory ) );
           OutputStream os = new BufferedOutputStream( Files.newOutputStream( copy ) ) )
      {
        StreamUtil.copy( is, os );
      }
      catch( Exception e )
      {
        throw new RuntimeException( e );
      }
    }
  }
1255364
@Override
	public FSDataOutputStream create(Path f, WriteMode overwriteMode) throws IOException {
		return createOutputStream(() -> originalFs.create(f, overwriteMode));
	}