当前位置: 首页>>代码示例>>Java>>正文


Java IOCase类代码示例

本文整理汇总了Java中org.apache.commons.io.IOCase的典型用法代码示例。如果您正苦于以下问题:Java IOCase类的具体用法?Java IOCase怎么用?Java IOCase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IOCase类属于org.apache.commons.io包,在下文中一共展示了IOCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResourcesWithExtension

import org.apache.commons.io.IOCase; //导入依赖的package包/类
public ArrayList<String> getResourcesWithExtension(String ext, String containerName) {
	ArrayList<String> ret = new ArrayList<String>();
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File prjLoc = new File(loc.toString());
		Collection<File> res = FileUtils.listFiles(prjLoc, FileFilterUtils.suffixFileFilter(ext, IOCase.INSENSITIVE), TrueFileFilter.INSTANCE);
		for (File file : res)
			ret.add(file.getAbsolutePath());
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:15,代码来源:PluginUtil.java

示例2: FileAlterationObserver

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct an observer for the specified directory, file filter and
 * file comparator.
 *
 * @param rootEntry the root directory to observe
 * @param fileFilter The file filter or null if none
 * @param caseSensitivity  what case sensitivity to use comparing file names, null means system sensitive
 */
protected FileAlterationObserver(FileEntry rootEntry, FileFilter fileFilter, IOCase caseSensitivity) {
    if (rootEntry == null) {
        throw new IllegalArgumentException("Root entry is missing");
    }
    if (rootEntry.getFile() == null) {
        throw new IllegalArgumentException("Root directory is missing");
    }
    this.rootEntry = rootEntry;
    this.fileFilter = fileFilter;
    if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
        this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
    } else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
        this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
    } else {
        this.comparator = NameFileComparator.NAME_COMPARATOR;
    }
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:26,代码来源:FileAlterationObserver.java

示例3: getModels

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Gets the models.
 *
 * @return the models
 */
public static String[] getModels() {
	File dir = new File(Config.getConfiguration().getString(MODELPATH));

	LOG.info("Loading Models from... " + dir.getAbsolutePath());
	List<String> models = new ArrayList<>();
	String[] modelNames = getModelNames();

	List<String> wildCardPath = Arrays.stream(modelNames).map(model -> {
		return "en-ner-" + model + "*.bin";
	}).collect(Collectors.toList());

	FileFilter fileFilter = new WildcardFileFilter(wildCardPath,
			IOCase.INSENSITIVE);
	List<String> filePath = Arrays.asList(dir.listFiles(fileFilter))
			.stream().map(file -> file.getAbsolutePath())
			.collect(Collectors.toList());
	return filePath.toArray(new String[filePath.size()]);
}
 
开发者ID:TekstoSense,项目名称:opennlp-enhancer,代码行数:24,代码来源:ModelLoaderConfig.java

示例4: FileAlterationObserver

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct an observer for the specified directory, file filter and
 * file comparator.
 *
 * @param rootEntry the root directory to observe
 * @param fileFilter The file filter or null if none
 * @param caseSensitivity  what case sensitivity to use comparing file names, null means system sensitive
 */
protected FileAlterationObserver(final FileEntry rootEntry, final FileFilter fileFilter,
                                 final IOCase caseSensitivity) {
    if (rootEntry == null) {
        throw new IllegalArgumentException("Root entry is missing");
    }
    if (rootEntry.getFile() == null) {
        throw new IllegalArgumentException("Root directory is missing");
    }
    this.rootEntry = rootEntry;
    this.fileFilter = fileFilter;
    if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
        this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
    } else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
        this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
    } else {
        this.comparator = NameFileComparator.NAME_COMPARATOR;
    }
}
 
开发者ID:PuppyRush,项目名称:WidgetStore,代码行数:27,代码来源:FileAlterationObserver.java

示例5: forFile

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/** The extension for the given file. */
public static Optional<FileExt> forFile(String path) {
  int n = path.length();
  int dot = path.lastIndexOf('.');
  if (dot < 0 || dot + 1 == n) { return Optional.absent(); }
  for (int i = dot + 1; i < n; ++i) {
    char ch = path.charAt(i);
    if (ch == '/' || ch == '\\') {
      return Optional.absent();
    }
  }
  String ext = path.substring(dot + 1);
  if (IOCase.SYSTEM.isCaseSensitive()) {
    // TODO: This may not do the right thing on Mac.
    // TODO: Should this be done in valueOf?
    ext = ext.toLowerCase(Locale.ENGLISH);  // No locale-specific folding
  }
  return Optional.of(valueOf(ext));
}
 
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:20,代码来源:FileExt.java

示例6: findFilesToAnalyze

import org.apache.commons.io.IOCase; //导入依赖的package包/类
public static List<String> findFilesToAnalyze(String dirPath) {
	IOFileFilter gitFilter = FileFilterUtils.notFileFilter(
					FileFilterUtils.nameFileFilter(".git")
			);
	File dir = new File(dirPath);
	String[] phpExt = new String[] {"php"};
	IOFileFilter phpFilter = new SuffixFileFilter(phpExt, IOCase.INSENSITIVE);
	List<File> files = (List<File>) FileUtils.listFiles(dir, phpFilter, gitFilter);
	List<String> results = new ArrayList<String>();
	for (File f : files) {
		try {
			results.add(f.getCanonicalPath());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	return results;
}
 
开发者ID:wsdookadr,项目名称:mdetect,代码行数:20,代码来源:FileScanUtils.java

示例7: equals

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Checks whether two filenames are equal, optionally normalizing and providing
 * control over the case-sensitivity.
 *
 * @param filename1  the first filename to query, may be null
 * @param filename2  the second filename to query, may be null
 * @param normalized  whether to normalize the filenames
 * @param caseSensitivity  what case sensitivity rule to use, null means case-sensitive
 * @return true if the filenames are equal, null equals null
 * @since 1.3
 */
public static boolean equals(
        String filename1, String filename2,
        boolean normalized, IOCase caseSensitivity) {
    
    if (filename1 == null || filename2 == null) {
        return filename1 == null && filename2 == null;
    }
    if (normalized) {
        filename1 = normalize(filename1);
        filename2 = normalize(filename2);
        if (filename1 == null || filename2 == null) {
            throw new NullPointerException(
                "Error normalizing one or both of the file names");
        }
    }
    if (caseSensitivity == null) {
        caseSensitivity = IOCase.SENSITIVE;
    }
    return caseSensitivity.checkEquals(filename1, filename2);
}
 
开发者ID:mavek87,项目名称:Java-MyCopies,代码行数:32,代码来源:FilenameUtils.java

示例8: FileAlterationObserver

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct an observer for the specified directory, file filter and
 * file comparator.
 *
 * @param rootEntry the root directory to observe
 * @param fileFilter The file filter or null if none
 * @param caseSensitivity  what case sensitivity to use comparing file names, null means system sensitive
 */
protected FileAlterationObserver(FileEntry rootEntry, FileFilter fileFilter, IOCase caseSensitivity, boolean circulate) {
    if (rootEntry == null) {
        throw new IllegalArgumentException("Root entry is missing");
    }
    if (rootEntry.getFile() == null) {
        throw new IllegalArgumentException("Root directory is missing");
    }
    this.rootEntry = rootEntry;
    this.fileFilter = fileFilter;
    this.circulate = circulate;
    if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
        this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
    } else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
        this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
    } else {
        this.comparator = NameFileComparator.NAME_COMPARATOR;
    }
}
 
开发者ID:Jakegogo,项目名称:concurrent,代码行数:27,代码来源:FileAlterationObserver.java

示例9: PathAlterationObserver

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * The comparison between path is always case-sensitive in this general file system context.
 */
public PathAlterationObserver(final FileStatusEntry rootEntry, final PathFilter pathFilter)
    throws IOException {
  if (rootEntry == null) {
    throw new IllegalArgumentException("Root entry is missing");
  }
  if (rootEntry.getPath() == null) {
    throw new IllegalArgumentException("Root directory is missing");
  }
  this.rootEntry = rootEntry;
  this.pathFilter = pathFilter;

  this.fs = rootEntry.getPath().getFileSystem(new Configuration());

  // By default, the comparsion is case sensitive.
  this.comparator = new Comparator<Path>() {
    @Override
    public int compare(Path o1, Path o2) {
      return IOCase.SENSITIVE.checkCompareTo(o1.toUri().toString(), o2.toUri().toString());
    }
  };
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:25,代码来源:PathAlterationObserver.java

示例10: VFSManager

import org.apache.commons.io.IOCase; //导入依赖的package包/类
public VFSManager(File systemDir, File userDir) {
    super(systemDir, userDir, new SuffixFileFilter(".xml", IOCase.INSENSITIVE));

    Comparator<File> nameComparator = new Comparator<File>() {
        @Override
        public int compare(File f1, File f2) {
            // we want vfs.xml to loaded first, always.
            if (f1.getName().equals("x-vfs.xml"))
                return Integer.MIN_VALUE;
            if (f2.getName().equals("x-vfs.xml"))
                return Integer.MAX_VALUE;
            return f1.getName().compareToIgnoreCase(f2.getName());
        }
    };

    getSystemFiles().setNameComparator(nameComparator);
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:18,代码来源:VFSManager.java

示例11: buildTrainingDataFromCorpus

import org.apache.commons.io.IOCase; //导入依赖的package包/类
public static void buildTrainingDataFromCorpus(String dataSetName,
        File corpusRoot, FVGenerator fvGenerator, File dest)
        throws IOException {
    Collection<File> children = FileUtils.listFiles(corpusRoot,
            new RegexFileFilter(".+\\.txt", IOCase.INSENSITIVE), DirectoryFileFilter.INSTANCE);

    ArffSaver saver = new ArffSaver();
    saver.setFile(dest);
    saver.setRetrieval(Saver.INCREMENTAL);
    boolean first = true;
    for (File textFile : children) {

        Instances dataSet = buildTrainingDataFromFile(dataSetName, textFile, fvGenerator);

        if (first) {
            saver.setStructure(dataSet);

            first = false;
        }
        for (int i = 0; i < dataSet.numInstances(); ++i) {
            saver.writeIncremental(dataSet.instance(i));
        }

    }
    saver.getWriter().flush();
}
 
开发者ID:wittawatj,项目名称:ctwt,代码行数:27,代码来源:Actions.java

示例12: RegexFileFilter

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct a new regular expression filter with the specified flags case sensitivity.
 *
 * @param pattern regular string expression to match
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the pattern is null
 */
public RegexFileFilter(String pattern, IOCase caseSensitivity) {
    if (pattern == null) {
        throw new IllegalArgumentException("Pattern is missing");
    }
    int flags = 0;
    if (caseSensitivity != null && !caseSensitivity.isCaseSensitive()) {
        flags = Pattern.CASE_INSENSITIVE;
    }
    this.pattern = Pattern.compile(pattern, flags);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:18,代码来源:RegexFileFilter.java

示例13: NameFileFilter

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct a new name file filter specifying case-sensitivity.
 *
 * @param name  the name to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the name is null
 */
public NameFileFilter(String name, IOCase caseSensitivity) {
    if (name == null) {
        throw new IllegalArgumentException("The wildcard must not be null");
    }
    this.names = new String[] {name};
    this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:15,代码来源:NameFileFilter.java

示例14: WildcardFileFilter

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct a new wildcard filter for a single wildcard specifying case-sensitivity.
 *
 * @param wildcard  the wildcard to match, not null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the pattern is null
 */
public WildcardFileFilter(String wildcard, IOCase caseSensitivity) {
    if (wildcard == null) {
        throw new IllegalArgumentException("The wildcard must not be null");
    }
    this.wildcards = new String[] { wildcard };
    this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:15,代码来源:WildcardFileFilter.java

示例15: NameFileFilter

import org.apache.commons.io.IOCase; //导入依赖的package包/类
/**
 * Construct a new name file filter specifying case-sensitivity.
 *
 * @param name  the name to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the name is null
 */
public NameFileFilter(String name, IOCase caseSensitivity) {
    if (name == null) {
        throw new IllegalArgumentException("The wildcard must not be null");
    }
    this.names = new String[] {name};
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:NameFileFilter.java


注:本文中的org.apache.commons.io.IOCase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。