Java Code Examples for org.apache.commons.io.filefilter.FileFilterUtils#makeFileOnly()
The following examples show how to use
org.apache.commons.io.filefilter.FileFilterUtils#makeFileOnly() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LicenseHeaderUpdate.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
public static void handleJavaStyleComments( String baseDir ) throws Exception { IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter( FileFilterUtils.suffixFileFilter("java"), FileFilterUtils.suffixFileFilter("js") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("css") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("groovy") ); sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter); sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter); LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "/*", " * ", " */"); Collection<String> results = dw.run( baseDir ); System.out.println( results ); }
Example 2
Source File: LicenseHeaderUpdate.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
public static void handleXMLStyleComments( String baseDir ) throws Exception { IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter( FileFilterUtils.suffixFileFilter("xml"), FileFilterUtils.suffixFileFilter("jrxml") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("html") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("htm") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("xsd") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("tld") ); sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter); sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter); LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "<!--", " - ", " -->"); Collection<String> results = dw.run( baseDir ); System.out.println( results ); }
Example 3
Source File: LicenseHeaderUpdate.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
public static void handleJSPStyleComments( String baseDir ) throws Exception { IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter( FileFilterUtils.suffixFileFilter("jsp"), FileFilterUtils.suffixFileFilter("tag") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("inc") ); sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter); sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter); LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "<%--", " - ", "--%>"); Collection<String> results = dw.run( baseDir ); System.out.println( results ); }
Example 4
Source File: LicenseHeaderUpdate.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
public static void handlePropertyStyleComments( String baseDir ) throws Exception { IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter( FileFilterUtils.suffixFileFilter("properties"), FileFilterUtils.suffixFileFilter("cmd") ); sourceFileFilter = FileFilterUtils.orFileFilter( sourceFileFilter, FileFilterUtils.suffixFileFilter("sh") ); sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter); sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter); LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "########################################", "# ", "########################################"); Collection<String> results = dw.run( baseDir ); System.out.println( results ); }
Example 5
Source File: LicenseHeaderUpdate.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
public static void handleSQLStyleComments( String baseDir ) throws Exception { IOFileFilter sourceFileFilter = FileFilterUtils.suffixFileFilter("sql"); sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter); sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter); LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "--", "-- ", LINE_SEPARATOR); Collection<String> results = dw.run( baseDir ); System.out.println( results ); }
Example 6
Source File: DirectoryWalker.java From aion-germany with GNU General Public License v3.0 | 3 votes |
/** * Construct an instance with a directory and a file filter and an optional * limit on the <i>depth</i> navigated to. * <p> * The filters control which files and directories will be navigated to as part * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)} * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters. * A {@code null} filter means that no filtering should occur. * * @param directoryFilter the filter to apply to directories, null means visit all directories * @param fileFilter the filter to apply to files, null means visit all files * @param depthLimit controls how <i>deep</i> the hierarchy is * navigated to (less than 0 means unlimited) */ protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, int depthLimit) { if (directoryFilter == null && fileFilter == null) { this.filter = null; } else { directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE; fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE; directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter); fileFilter = FileFilterUtils.makeFileOnly(fileFilter); this.filter = FileFilterUtils.or(directoryFilter, fileFilter); } this.depthLimit = depthLimit; }
Example 7
Source File: DirectoryWalker.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Construct an instance with a directory and a file filter and an optional * limit on the <i>depth</i> navigated to. * <p> * The filters control which files and directories will be navigated to as part * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)} * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters. * A {@code null} filter means that no filtering should occur. * * @param directoryFilter the filter to apply to directories, null means visit all directories * @param fileFilter the filter to apply to files, null means visit all files * @param depthLimit controls how <i>deep</i> the hierarchy is * navigated to (less than 0 means unlimited) */ protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, final int depthLimit) { if (directoryFilter == null && fileFilter == null) { this.filter = null; } else { directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE; fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE; directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter); fileFilter = FileFilterUtils.makeFileOnly(fileFilter); this.filter = FileFilterUtils.or(directoryFilter, fileFilter); } this.depthLimit = depthLimit; }