EMsnap commented on code in PR #9103: URL: https://github.com/apache/inlong/pull/9103#discussion_r1370055454
########## inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/file/FileFinderIterator.java: ########## @@ -0,0 +1,164 @@ +/* + * 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.inlong.agent.utils.file; + +import com.google.common.base.Predicate; + +import java.io.File; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Queue; + +/** + * Implements an {@link Iterator<File>} that runs the recursive search that has been defined by the + * {@link FileFinder} builder object. + * + * @author Florian Maul + */ +public class FileFinderIterator implements Iterator<File> { + + /** + * The {@link Predicate} that defines the type of files that will be returned. + */ + private final Predicate<File> yieldFilter; + /** + * The {@link Predicate} that is used for branching with recursion. + */ + private final Predicate<File> branchFilter; + /** + * The {@link Predicate} that is used as filter to find specific files. + */ + private final Predicate<File> fileFilter; + private final Predicate<File> dirFilter; + /** + * A stack that stores all files and directories that still habe to be processed. + */ + // private LinkedList<File> fileStack = new LinkedList<File>(); Review Comment: remove this please -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
