package com.qianwen.core.tool.utils; import java.io.File; import java.io.FileFilter; import java.io.Serializable; import org.springframework.util.Assert; /* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/utils/SuffixFileFilter.class */ public class SuffixFileFilter implements FileFilter, Serializable { private static final long serialVersionUID = -3389157631240246157L; private final String[] suffixes; public SuffixFileFilter(final String suffix) { Assert.notNull(suffix, "The suffix must not be null"); this.suffixes = new String[]{suffix}; } public SuffixFileFilter(final String[] suffixes) { Assert.notNull(suffixes, "The suffix must not be null"); this.suffixes = new String[suffixes.length]; System.arraycopy(suffixes, 0, this.suffixes, 0, suffixes.length); } @Override // java.io.FileFilter public boolean accept(File pathname) { String[] strArr; String name = pathname.getName(); for (String suffix : this.suffixes) { if (checkEndsWith(name, suffix)) { return true; } } return false; } private boolean checkEndsWith(final String str, final String end) { int endLen = end.length(); return str.regionMatches(true, str.length() - endLen, end, 0, endLen); } }