Java Path File List nio validateAndAdd(Path path, String expression, LinkedList files)

Here you can find the source of validateAndAdd(Path path, String expression, LinkedList files)

Description

validate And Add

License

Apache License

Declaration

public static void validateAndAdd(Path path, String expression, LinkedList<File> files) 

Method Source Code


//package com.java2s;
/*//from  w w  w.  ja  v a  2s  .c  om
 * 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.
 */

import java.io.File;

import java.nio.file.Path;

import java.util.LinkedList;
import java.util.regex.Pattern;

public class Main {
    public static void validateAndAdd(Path path, String expression, LinkedList<File> files) {
        if (expression == null || Pattern.matches(expression, path.toString())) {
            files.add(new File(path.toString()));
        }
    }
}

Related

  1. registerRecursive(final WatchService watcher, final List startingPaths)
  2. retrieveTokenFilesInDirImportableFrom(Path dir, List excludedTokenFiles)
  3. toCliString(Path agentPath, String param)
  4. toFile(Path file, String list)
  5. uncheckedList(final Path path)