All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.scada.utils.io.RecursiveDeleteVisitor Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2014, 2016 IBH SYSTEMS GmbH and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/
package org.eclipse.scada.utils.io;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.FileVisitor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

public class RecursiveDeleteVisitor extends SimpleFileVisitor
{
    public static final FileVisitor INSTANCE = new RecursiveDeleteVisitor ();

    @Override
    public FileVisitResult visitFile ( final Path file, final BasicFileAttributes attrs ) throws IOException
    {
        Files.delete ( file );
        return super.visitFile ( file, attrs );
    }

    @Override
    public FileVisitResult postVisitDirectory ( final Path dir, final IOException exc ) throws IOException
    {
        Files.delete ( dir );
        return super.postVisitDirectory ( dir, exc );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy