Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.apache.marmotta.platform.core.util;
Add file description here!

Author: Sebastian Schaffert

public class KiWiIO {

Deletes all the files within a directory. Does not delete the directory itself.

If the file argument is a symbolic link or there is a symbolic link in the path leading to the directory, this method will do nothing. Symbolic links within the directory are not followed.

Parameters:
directory the directory to delete the contents of
Throws:
java.lang.IllegalArgumentException if the argument is not a directory
java.io.IOException if an I/O error occurs
See also:
deleteRecursively(java.io.File)
	public static void deleteDirectoryContents(File directory)
			throws IOException {
		Preconditions.checkArgument(directory.isDirectory(),
				"Not a directory: %s"directory);
		File[] files = directory.listFiles();
		if (files == null) {
			throw new IOException("Error listing files for " + directory);
		}
		for (File file : files) {
		}
	}

Deletes a file or directory and all contents recursively.

If the file argument is a symbolic link the link will be deleted but not the target of the link. If the argument is a directory, symbolic links within the directory will not be followed.

Parameters:
file the file to delete
Throws:
java.io.IOException if an I/O error occurs
See also:
deleteDirectoryContents(java.io.File)
	public static void deleteRecursively(File filethrows IOException {
		if (file.isDirectory()) {
		}
		if (!file.delete()) {
			throw new IOException("Failed to delete " + file);
		}
	}
New to GrepCode? Check out our FAQ X