Removed FolderCreateMode from filesystem api

* Folder#create now always creates the parents
This commit is contained in:
Markus Kreusch
2015-12-28 21:29:34 +01:00
parent 62d8cdfe4f
commit d073bdfad9
18 changed files with 91 additions and 188 deletions
@@ -6,7 +6,7 @@ class Copier {
assertFoldersAreNotNested(source, destination);
destination.delete();
destination.create(FolderCreateMode.INCLUDING_PARENTS);
destination.create();
source.files().forEach(sourceFile -> {
File destinationFile = destination.file(sourceFile.name());
@@ -5,7 +5,6 @@
******************************************************************************/
package org.cryptomator.filesystem;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.stream.Stream;
@@ -56,19 +55,14 @@ public interface Folder extends Node {
Folder folder(String name) throws UncheckedIOException;
/**
* Creates the directory, if it doesn't exist yet. No effect, if folder
* already exists.
* Creates the directory including all parent directories, if it doesn't
* exist yet. No effect, if folder already exists.
*
* @param mode
* Depending on this option either the attempt is made to
* recursively create all parent directories or an exception is
* thrown if the parent doesn't exist yet.
* @throws UncheckedIOException
* wrapping an {@link FileNotFoundException}, if mode is
* {@link FolderCreateMode#FAIL_IF_PARENT_IS_MISSING
* FAIL_IF_PARENT_IS_MISSING} and parent doesn't exist.
* if an {@link IOException} occurs while creating the folder or
* one of its parents
*/
void create(FolderCreateMode mode) throws UncheckedIOException;
void create() throws UncheckedIOException;
/**
* Recusively copies this directory and all its contents to (not into) the
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 Markus Kreusch
* This file is licensed under the terms of the MIT license.
* See the LICENSE.txt file for more info.
******************************************************************************/
package org.cryptomator.filesystem;
public enum FolderCreateMode {
FAIL_IF_PARENT_IS_MISSING, INCLUDING_PARENTS
}