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

org.codehaus.plexus.util.Scanner Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package org.codehaus.plexus.util;

/*
 * Copyright The Codehaus Foundation.
 *
 * Licensed 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.
 */

import java.io.File;

/**
 * Scan a directory tree for files, with specified inclusions and exclusions.
 */
public interface Scanner
{

    /**
     * Sets the list of include patterns to use. All '/' and '\' characters
     * are replaced by File.separatorChar, so the separator used
     * need not match File.separatorChar.
     * 

* When a pattern ends with a '/' or '\', "**" is appended. * * @param includes A list of include patterns. * May be null, indicating that all files * should be included. If a non-null * list is given, all elements must be * non-null. */ void setIncludes(String[] includes); /** * Sets the list of exclude patterns to use. All '/' and '\' characters * are replaced by File.separatorChar, so the separator used * need not match File.separatorChar. *

* When a pattern ends with a '/' or '\', "**" is appended. * * @param excludes A list of exclude patterns. * May be null, indicating that no files * should be excluded. If a non-null list is * given, all elements must be non-null. */ void setExcludes(String[] excludes); /** * Adds default exclusions to the current exclusions set. */ void addDefaultExcludes(); /** * Scans the base directory for files which match at least one include * pattern and don't match any exclude patterns. * * @exception IllegalStateException if the base directory was set * incorrectly (i.e. if it is null, doesn't exist, * or isn't a directory). */ void scan(); /** * Returns the names of the files which matched at least one of the * include patterns and none of the exclude patterns. * The names are relative to the base directory. * * @return the names of the files which matched at least one of the * include patterns and none of the exclude patterns. */ String[] getIncludedFiles(); /** * Returns the names of the directories which matched at least one of the * include patterns and none of the exclude patterns. * The names are relative to the base directory. * * @return the names of the directories which matched at least one of the * include patterns and none of the exclude patterns. */ String[] getIncludedDirectories(); /** * Returns the base directory to be scanned. * This is the directory which is scanned recursively. * * @return the base directory to be scanned */ File getBasedir(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy