本文整理匯總了Java中org.apache.tools.ant.DirectoryScanner.setCaseSensitive方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectoryScanner.setCaseSensitive方法的具體用法?Java DirectoryScanner.setCaseSensitive怎麽用?Java DirectoryScanner.setCaseSensitive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.DirectoryScanner
的用法示例。
在下文中一共展示了DirectoryScanner.setCaseSensitive方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scanForFiles
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private static void scanForFiles(Collection<File> destination, String pathAndMask) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setCaseSensitive(false);
String pathPart = FilenameUtils.getFullPath(pathAndMask);
if(StringUtils.isEmpty(pathPart))
{
scanner.setBasedir(Paths.get(".").toAbsolutePath().normalize().toFile());
scanner.setIncludes(new String[]{pathAndMask});
}
else
{
scanner.setBasedir(new File(pathPart));
scanner.setIncludes(new String[]{FilenameUtils.getName(pathAndMask)});
}
scanner.scan();
for (String file : scanner.getIncludedFiles()) {
destination.add(new File(scanner.getBasedir(),file));
}
}
示例2: listFiles
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
@Override
public List<File> listFiles(final String mask) {
try {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[]{mask});
scanner.setBasedir(this.basedir.replace("\\", "/"));
scanner.setCaseSensitive(false);
scanner.scan();
String[] files = scanner.getIncludedFiles();
List<File> result = new ArrayList<>();
for (String file : files) {
result.add(
new SimpleFile(file,
FileUtils.readFileToByteArray(new java.io.File(basedir + "/" + file))));
}
return result;
} catch (IOException exception) {
throw new BootException(exception);
}
}
示例3: downloadProjectSDK
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
* Downloads an SDK for needed language.
*
* @param lang SDK language
* @param response standard response
* @throws SandboxServiceException if couldn't download
*/
@RequestMapping(value = "demoProjects/download/sdk/{lang}", method = RequestMethod.GET)
public void downloadProjectSDK(@PathVariable String lang, HttpServletResponse response) throws SandboxServiceException {
String sdkPath = "/usr/lib/kaa-node/sdk/" + lang + "/";
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[]{"kaa-*"});
scanner.setBasedir(sdkPath);
scanner.setCaseSensitive(false);
try {
scanner.scan();
String[] files = scanner.getIncludedFiles();
if (files.length == 0) {
LOG.warn("No SDK found for language [{}]", lang);
return;
}
String sdkFullName = sdkPath + files[0];
LOG.info("Downloading SDK [{}]", sdkFullName);
response.setHeader("Content-disposition", "attachment; filename=" + files[0]);
IOUtils.copy(Files.newInputStream(Paths.get(sdkFullName)), response.getOutputStream());
response.flushBuffer();
} catch (IOException e) {
LOG.error("Couldn't download SDK for language [{}]", lang);
throw new SandboxServiceException(e);
}
}
示例4: removeTestClasses
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
* Remove as classes de teste do sistema, para que elas nao entrem na
* analise. Todos os diretorios cujo nome comeca com 'test' (test*) serão
* excluídos.
*/
public void removeTestClasses() {
System.out.println("Deleting test folders");
DirectoryScanner scanner = new DirectoryScanner();
String[] includes = { "**/test*" };
scanner.setIncludes(includes);
scanner.setBasedir(src_path);
scanner.setCaseSensitive(false);
scanner.scan();
String[] included_dirs = scanner.getIncludedDirectories();
for (String test_dir : included_dirs) {
File dirToDelete = new File(src_path, test_dir);
if (dirToDelete.exists())
FileUtils.deleteRecursive(dirToDelete);
}
}
示例5: getUserModuleLibFiles
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
* 獲取用戶模塊加載文件/目錄(集合)
*
* @return 用戶模塊加載文件/目錄(集合)
*/
public synchronized File[] getUserModuleLibFiles() {
final DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(getUserModuleLibPaths());
scanner.setCaseSensitive(false);
scanner.scan();
final String[] filePaths = scanner.getIncludedDirectories();
final File[] files = new File[filePaths.length];
for (int index = 0; index < filePaths.length; index++) {
files[index] = new File(filePaths[index]);
}
return GET_USER_MODULE_LIB_FILES_CACHE = files;
}
示例6: createDirectoryScanner
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private DirectoryScanner createDirectoryScanner(File baseDir, String[] filterExcludePatterns, String[] filterIncludePatterns) {
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(baseDir);
ds.setCaseSensitive(false);
ds.setFollowSymlinks(false);
ds.setErrorOnMissingDir(false);
if (filterIncludePatterns != null && filterIncludePatterns.length > 0) {
ds.setIncludes(filterIncludePatterns);
}
if (filterExcludePatterns != null && filterExcludePatterns.length > 0) {
ds.setExcludes(filterExcludePatterns);
}
return ds;
}
示例7: invoke
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
public String[] invoke(File basedir, VirtualChannel virtualChannel) throws IOException, InterruptedException {
DirectoryScanner ds = new DirectoryScanner();
String[] includes = { pattern };
ds.setIncludes(includes);
ds.setBasedir(basedir);
ds.setCaseSensitive(true);
ds.scan();
return ds.getIncludedFiles();
}
示例8: fetchPropertyFiles
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private List<String> fetchPropertyFiles(File targetDirectory, TaskListener listener) {
List<String> propertyFiles = new ArrayList<>();
if (StringUtils.isNotEmpty(classificationsFilePattern)) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[]{classificationsFilePattern});
scanner.setBasedir(targetDirectory);
scanner.setCaseSensitive(false);
scanner.scan();
propertyFiles = getFullMetaDataPath(scanner.getIncludedFiles(), targetDirectory.toString());
for (String propertyFile : propertyFiles) {
log(listener, String.format("Found Properties File - %s ", propertyFile));
}
}
return propertyFiles;
}
示例9: searchFiles
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
public static String[] searchFiles(String searchPath, String searchString) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[]{searchString + "*.php"});
scanner.setBasedir(searchPath);
scanner.setCaseSensitive(false);
scanner.scan();
return scanner.getIncludedFiles();
}
示例10: searchFolders
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
public static String[] searchFolders(String searchPath, String searchString) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[]{searchString + "*"});
scanner.setExcludes(new String[]{searchString + "*.php"});
scanner.setBasedir(searchPath);
scanner.setCaseSensitive(false);
scanner.scan();
return scanner.getIncludedDirectories();
}
示例11: processProjectDir
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private void processProjectDir(File f) {
String prjPath = null;
//if (f.getAbsolutePath().equals(baseDir.getAbsolutePath())) {
// prjPath = "";
//} else {
prjPath = f.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
//}
log("Processing project dir: " + prjPath);
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(f);
ds.setIncludes(getAsArray(iconIncludes));
ds.setExcludes(getAsArray(iconExcludes));
ds.setCaseSensitive(false);
ds.scan();
String[] files = ds.getIncludedFiles();
log(" Found " + files.length + " files in " + f);
List<ImageInfo> goodIcons = new ArrayList<>();
List<ImageInfo> badIcons = new ArrayList<>();
for (String file : files) {
String ext = file.substring(file.lastIndexOf('.') + 1);
if (ext.equalsIgnoreCase("gif") || ext.equalsIgnoreCase("png")) {
File iconFile = new File(f, file);
try {
ImageInfo imageInfo = null;
imageInfo = readImageInfo(iconFile);
if (imageInfo != null) {
imageInfo.setPath(file);
imageInfo.setExt(ext);
int w = imageInfo.getWidth();
int h = imageInfo.getHeight();
if ((w == 8 && h == 8) || (w == 16 && h == 16) ||
(w == 24 && h == 24) || (w == 32 && h == 32)) {
goodIcons.add(imageInfo);
} else {
badIcons.add(imageInfo);
}
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
ProjectIconInfo prjIconInfo = new ProjectIconInfo(prjPath, goodIcons, badIcons);
prjIconInfoList.add(prjIconInfo);
}
示例12: postProcessGeneratedJavadocs
import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private void postProcessGeneratedJavadocs() throws IOException {
if (!postProcessGeneratedJavadocs) {
return;
}
if (destDir != null && !destDir.isDirectory()) {
log("No javadoc created, no need to post-process anything",
Project.MSG_VERBOSE);
return;
}
final InputStream in = Javadoc.class
.getResourceAsStream("javadoc-frame-injections-fix.txt");
if (in == null) {
throw new FileNotFoundException(
"Missing resource 'javadoc-frame-injections-fix.txt' in classpath.");
}
final String fixData;
try {
fixData =
fixLineFeeds(FileUtils
.readFully(new InputStreamReader(in, "US-ASCII")))
.trim();
} finally {
FileUtils.close(in);
}
final DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(destDir);
ds.setCaseSensitive(false);
ds.setIncludes(new String[] {
"**/index.html", "**/index.htm", "**/toc.html", "**/toc.htm"
});
ds.addDefaultExcludes();
ds.scan();
int patched = 0;
for (final String f : ds.getIncludedFiles()) {
patched += postProcess(new File(destDir, f), fixData);
}
if (patched > 0) {
log("Patched " + patched + " link injection vulnerable javadocs",
Project.MSG_INFO);
}
}