本文整理汇总了Java中org.apache.commons.io.filefilter.HiddenFileFilter类的典型用法代码示例。如果您正苦于以下问题:Java HiddenFileFilter类的具体用法?Java HiddenFileFilter怎么用?Java HiddenFileFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HiddenFileFilter类属于org.apache.commons.io.filefilter包,在下文中一共展示了HiddenFileFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
testDir = new File(new File(".") , testDirName);
if (testDir.exists()) {
org.apache.commons.io.FileUtils.cleanDirectory(testDir);
} else {
testDir.mkdir();
}
IOFileFilter files = org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter();
IOFileFilter javaSuffix = org.apache.commons.io.filefilter.FileFilterUtils.suffixFileFilter(".java");
IOFileFilter fileFilter = org.apache.commons.io.filefilter.FileFilterUtils.and(files, javaSuffix);
IOFileFilter directories = org.apache.commons.io.filefilter.FileFilterUtils.directoryFileFilter();
IOFileFilter visible = HiddenFileFilter.VISIBLE;
IOFileFilter dirFilter = org.apache.commons.io.filefilter.FileFilterUtils.and(directories, visible);
IOFileFilter filter = org.apache.commons.io.filefilter.FileFilterUtils.or(dirFilter, fileFilter);
createObserver(testDir, filter);
}
示例2: loadPosts
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
/**
* 读取post信息
* <br><i>at 2014年7月12日下午4:36:36</i>
* @author lichee
* @see <a href="http://nicecoder.net">nicecoder.net</a>
*/
private void loadPosts(){
PostWalker pw = new PostWalker(
HiddenFileFilter.VISIBLE,
genFilter
);
try {
Collection<Post> rs = pw.loadPosts(new File(postsDir));
posts = new HashMap<String,Post>();
for(Post p : rs){
posts.put(p.getTitle(), p);
}
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: Get
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
/**
* Builds a *VisibleFilesTraverser*.
* @param startDirectory
* @param ignoreFileNames
* @return
*/
public static VisibleFilesTraverser Get(Path startDirectory, String...ignoreFileNames) {
return new VisibleFilesTraverser(
startDirectory,
ignoreFileNames,
FileFilterUtils.or(
// Show visible directories
FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), HiddenFileFilter.VISIBLE),
// Show visible files
FileFilterUtils.and(FileFilterUtils.fileFileFilter(), HiddenFileFilter.VISIBLE)
)
);
}
示例4: getFilesFromDirectory
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public static List<File> getFilesFromDirectory(File directory) {
IOFileFilter fileFilter = FileFilterUtils.makeSVNAware(HiddenFileFilter.VISIBLE);
IOFileFilter dirFilter = FileFilterUtils.makeSVNAware(FileFilterUtils.and(
FileFilterUtils.directoryFileFilter(),
HiddenFileFilter.VISIBLE));
return new ArrayList<File>(FileUtils.listFiles(directory, fileFilter, dirFilter));
}
示例5: extractPossibleDataFile
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
private static List<File> extractPossibleDataFile(File dwcFolder) {
List<File> dataFiles = new ArrayList<>();
for (String suffix : DATA_FILE_SUFFICES) {
FileFilter ff = FileFilterUtils.and(
FileFilterUtils.suffixFileFilter(suffix, IOCase.INSENSITIVE), HiddenFileFilter.VISIBLE
);
dataFiles.addAll(Arrays.asList(dwcFolder.listFiles(ff)));
}
return dataFiles;
}
示例6: fromCompressed
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
static Archive fromCompressed(Path dwcaLocation, Path destination) throws IOException, UnsupportedArchiveException {
if (!Files.exists(dwcaLocation)) {
throw new FileNotFoundException("dwcaLocation does not exist: " + dwcaLocation.toAbsolutePath());
}
if (Files.exists(destination)) {
// clean up any existing folder
LOG.debug("Deleting existing archive folder [{}]", destination.toAbsolutePath());
org.gbif.utils.file.FileUtils.deleteDirectoryRecursively(destination.toFile());
}
FileUtils.forceMkdir(destination.toFile());
// try to decompress archive
try {
CompressionUtil.decompressFile(destination.toFile(), dwcaLocation.toFile(), true);
// we keep subfolder, but often the entire archive is within one subfolder. Remove that root folder if present
File[] rootFiles = destination.toFile().listFiles((FileFilter) HiddenFileFilter.VISIBLE);
if (rootFiles.length == 1) {
File root = rootFiles[0];
if (root.isDirectory()) {
// single root dir, flatten structure
LOG.debug("Removing single root folder {} found in decompressed archive", root.getAbsoluteFile());
for (File f : FileUtils.listFiles(root, TrueFileFilter.TRUE, null)) {
File f2 = new File(destination.toFile(), f.getName());
f.renameTo(f2);
}
}
}
// continue to read archive from the tmp dir
return fromLocation(destination);
} catch (CompressionUtil.UnsupportedCompressionType e) {
throw new UnsupportedArchiveException(e);
}
}
示例7: loadVaults
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public void loadVaults() throws IOException, JDOMException {
GlacierVaultManager gvm;
File gRootDir = getGlacierRootDir();
log.debug("loadVaults(): getGlacierRootDir",getGlacierRootDir());
File[] vaults = gRootDir.listFiles((FileFilter) HiddenFileFilter.VISIBLE);
if (vaults != null) {
log.debug("loadVaults(): Got {} vaults",vaults.length);
for (File vault : vaults) {
if(!vault.getName().equals(DefaultResourceCacheDirectoryName)){
String vaultName = vault.getName();
log.debug("loadVaults(): Loading vault: {} vaultName: {}",vault, vaultName);
if (vault.isDirectory()) {
gvm = new GlacierVaultManager(vaultName,gRootDir);
gvm.setParentContext(getGlacierServiceContext());
// gvm.loadArchiveRecords();
gvm.loadIndexObjects();
_vaults.put(gvm.name(),gvm);
}
}
}
}
}
示例8: loadIndexObjects
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public void loadIndexObjects() throws IOException, JDOMException {
Index index;
File indexDir = getIndexDir();
File[] indexFiles = indexDir.listFiles((FileFilter) HiddenFileFilter.VISIBLE);
if (indexFiles != null) {
for (File indexFile : indexFiles) {
if (indexFile.isFile()) {
index = new Index(indexFile);
StringBuilder resourceId = new StringBuilder();
String pathDelimiter = index.getDelimiter();
resourceId
//.append(getGlacierServiceContext())
.append(index.getPath())
.append(pathDelimiter)
.append(index.getIndexFileConvention());
index.setResourceId(resourceId.toString());
_indexObjects.put(index.getResourceId(),index);
_log.debug("Loaded Index. Vault: {} resourceId: {}", name(), index.getResourceId());
}
else {
_log.debug("Skipping directory/link {}", indexFile);
}
}
} else {
_log.debug("No index files found for vault {}", name());
}
}
示例9: close
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
@Override
public void close() throws IOException {
// Delete all files that weren't written in this run.
Collection<File> files = FileUtils.listFiles(target, HiddenFileFilter.VISIBLE, TrueFileFilter.INSTANCE);
for (File file : files) {
if (!this.files.contains(file)) {
file.delete();
deleteEmptyDirectory(file.getParentFile());
}
}
}
示例10: getFolders
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public List<String> getFolders()
throws MojoExecutionException
{
IOFileFilter folders = FileFilterUtils.and( HiddenFileFilter.VISIBLE, DirectoryFileFilter.DIRECTORY );
IOFileFilter makeSVNAware = FileFilterUtils.makeSVNAware( folders );
IOFileFilter makeCVSAware = FileFilterUtils.makeCVSAware( makeSVNAware );
String[] list = folder.list( makeCVSAware );
if ( list == null )
{
throw new MojoExecutionException( "The specified folder doesn't exist: " + folder );
}
List<File> listOfDirectories = new ArrayList<File>();
for ( String item : list )
{
listOfDirectories.add( new File( folder, item ) );
}
Collections.sort( listOfDirectories, convertSortOrder() );
List<String> resultList = new ArrayList<String>();
for ( File file : listOfDirectories )
{
resultList.add( file.getName() );
}
return resultList;
}
示例11: getFiles
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public List<InputFile> getFiles() {
List<InputFile> result = Lists.newArrayList();
if (getSourceDirs() == null) {
return result;
}
IOFileFilter suffixFilter = getFileSuffixFilter();
WildcardPattern[] exclusionPatterns = getExclusionPatterns(true);
IOFileFilter visibleFileFilter = HiddenFileFilter.VISIBLE;
for (File dir : getSourceDirs()) {
if (dir.exists()) {
// exclusion filter
IOFileFilter exclusionFilter = new ExclusionFilter(dir,exclusionPatterns);
// visible filter
List<IOFileFilter> fileFilters = Lists.newArrayList(visibleFileFilter, suffixFilter, exclusionFilter);
// inclusion filter
String inclusionPattern = (String) project.getProperty(SpringPlugin.INCLUDE_FILE_FILTER);
if (inclusionPattern != null) {
fileFilters.add(new InclusionFilter(dir, inclusionPattern));
}
fileFilters.addAll(this.filters);
// create DefaultInputFile for each file.
List<File> files = (List<File>) FileUtils.listFiles(dir, new AndFileFilter(fileFilters), HiddenFileFilter.VISIBLE);
for (File file : files) {
String relativePath = DefaultProjectFileSystem.getRelativePath(file, dir);
result.add(new DefaultInputFile(dir, relativePath));
}
}
}
return result;
}
示例12: getFilesFromDirectory
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public static List<File> getFilesFromDirectory(File directory) {
IOFileFilter fileFilter = FileFilterUtils.makeSVNAware(HiddenFileFilter.VISIBLE);
IOFileFilter dirFilter = FileFilterUtils
.makeSVNAware(FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), HiddenFileFilter.VISIBLE));
return new ArrayList<File>(FileUtils.listFiles(directory, fileFilter, dirFilter));
}
示例13: accept
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
@Override
public boolean accept(File file) {
return FileFilterUtils.fileFileFilter().accept(file) && HiddenFileFilter.VISIBLE.accept(file);
}
示例14: LicensableFileDirectoryWalker
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
public LicensableFileDirectoryWalker( IOFileFilter fileFilter, String firstLine, String linePrefix, String lastLine ) {
super(HiddenFileFilter.VISIBLE,fileFilter,100);
this.firstLine = firstLine;
this.linePrefix = linePrefix;
this.lastLine = lastLine;
}
示例15: defaultDirectoryFilter
import org.apache.commons.io.filefilter.HiddenFileFilter; //导入依赖的package包/类
/**
* Limit directories to visible directories
*
* @return
*/
public static IOFileFilter defaultDirectoryFilter() {
return FileFilterUtils.and(
FileFilterUtils.directoryFileFilter(),
HiddenFileFilter.VISIBLE);
}