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


Java FileFilterUtils.trueFileFilter方法代码示例

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


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

示例1: getFileFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Override
protected FileFilter getFileFilter(final File workDirectory, final File hybrisDirectory) {
    final ExtensionBinary binary = extension.getBinary();
    if (binary instanceof None) {
        return FileFilterUtils.trueFileFilter();
    }
    final File exclude = new File(hybrisDirectory, binary.getExtensionBinaryPath().toString());
    return (File file) -> !file.toPath().startsWith(exclude.toPath());
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:10,代码来源:RestructureWebExtensionTask.java

示例2: run

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private void run() throws Exception {
    IOFileFilter corpusFileFilter;
    if (corpusFileSuffix == null) {
        corpusFileFilter = FileFilterUtils.trueFileFilter();
    } else {
        corpusFileFilter = FileFilterUtils.suffixFileFilter(corpusFileSuffix);
    }
    IOFileFilter corpusSubDirFilter = includeSubDirectores ? TrueFileFilter.INSTANCE : null;
    List<Set<File>> partitions = Lists.newArrayList(CorpusUtils.partitionCorpusByFileSize(
            corpusDir, corpusFileFilter, corpusSubDirFilter, partitionsNum));
    if (partitions.size() != partitionsNum) {
        throw new IllegalStateException();
    }
    // make dev partition from the last because it is a little bit smaller
    Set<File> devFiles = getAndRemove(partitions, partitions.size() - 1);
    Set<File> testFiles = getAndRemove(partitions, partitions.size() - 1);
    Set<File> trainFiles = Sets.newLinkedHashSet();
    for (Set<File> s : partitions) {
        trainFiles.addAll(s);
    }
    // write files
    File devPartFile = new File(outputDir, CorpusUtils.getDevPartitionFilename(0));
    FileUtils.writeLines(devPartFile, "utf-8", CorpusUtils.toRelativePaths(corpusDir, devFiles));
    File testPartFile = new File(outputDir, CorpusUtils.getTestPartitionFilename(0));
    FileUtils.writeLines(testPartFile, "utf-8", CorpusUtils.toRelativePaths(corpusDir, testFiles));
    File trainPartFile = new File(outputDir, CorpusUtils.getTrainPartitionFilename(0));
    FileUtils.writeLines(trainPartFile, "utf-8", CorpusUtils.toRelativePaths(corpusDir, trainFiles));
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:29,代码来源:TrainDevTestCorpusSplitter.java

示例3: run

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private void run() throws Exception {
    IOFileFilter corpusFileFilter;
    if (corpusFileSuffix == null) {
        corpusFileFilter = FileFilterUtils.trueFileFilter();
    } else {
        corpusFileFilter = FileFilterUtils.suffixFileFilter(corpusFileSuffix);
    }
    IOFileFilter corpusSubDirFilter = includeSubDirectores ? TrueFileFilter.INSTANCE : null;
    List<CorpusSplit> corpusSplits = CorpusUtils.createCrossValidationSplits(corpusDir,
            corpusFileFilter, corpusSubDirFilter, foldNum);
    for (int i = 0; i < corpusSplits.size(); i++) {
        writeFileLists(outputDir, i, corpusSplits.get(i));
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:15,代码来源:CrossValidationCorpusSplitter.java

示例4: initialize

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext ctx) throws ResourceInitializationException {
    super.initialize(ctx);
    if (!directory.isDirectory()) {
        throw new IllegalStateException(String.format(
                "%s is not existing file directory", directory));
    }
    IOFileFilter fileFilter = FileFilterUtils.suffixFileFilter(fileExtension);
    IOFileFilter subdirFilter = FileFilterUtils.trueFileFilter();
    files = Lists.newArrayList(FileUtils.listFiles(directory, fileFilter, subdirFilter));
    //
    lastReadFileIdx = -1;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:14,代码来源:FileDirectoryCollectionReader.java

示例5: initialize

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Override
public void initialize(final UimaContext context) throws ResourceInitializationException {
    log.info("Initializing Document Reader.");
    if (inputDirectory == null) {
        log.error("Couldn't find input directory parameter setting!");
        throw new ResourceInitializationException(ResourceInitializationException.CONFIG_SETTING_ABSENT,
                new Object[] {PARAM_INPUTDIR});
    }

    if (isPlaintextReader) {
        // FIXME: We just use the default encoding, which shouldn't be the case.
        casPopulater = new PlainTextCASPopulater(Charset.defaultCharset(), inputDirectory, outputDirectory);
    } else {
        // We don't like type errors, so we set lenient to false
        casPopulater = new XmiCASPopulater(false, inputDirectory, outputDirectory);
    }

    if (!inputDirectory.exists() || !inputDirectory.isDirectory()) {
        throw new ResourceInitializationException(ResourceConfigurationException.DIRECTORY_NOT_FOUND,
                new Object[] { PARAM_INPUTDIR, this.getMetaData().getName(), inputDirectory.getPath() });
    }

    final IOFileFilter always = FileFilterUtils.trueFileFilter();
    final Collection<File> files = FileUtils.listFiles(inputDirectory, always, always);

    // Unfortunately, iterators are not suited to keeping
    // track of progress, so we need to do it manually.
    fileIterator = files.iterator();
    totalFiles = files.size();
    progress = 0;

    log.debug("Found {} files to process in {}.", totalFiles, inputDirectory.getName());
}
 
开发者ID:adimit,项目名称:summarization,代码行数:34,代码来源:DocumentReader.java

示例6: getFileFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected FileFilter getFileFilter(final File workDirectory, final File hybrisDirectory) {
    return FileFilterUtils.trueFileFilter();
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:4,代码来源:RestructureExtensionTask.java

示例7: CopyDirectoryContentToDirectoryTask

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public CopyDirectoryContentToDirectoryTask(final File source, final File target) {
    this(source, target, FileFilterUtils.trueFileFilter());
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:4,代码来源:CopyDirectoryContentToDirectoryTask.java

示例8: CopyDirectoryFilesToDirectoryTask

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public CopyDirectoryFilesToDirectoryTask(final File source, final File target) {
    this(source, target, FileFilterUtils.trueFileFilter());
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:4,代码来源:CopyDirectoryFilesToDirectoryTask.java

示例9: getFiles

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@GET
@Path("files")
@Produces("application/zip")
//Swagger annotations
@ApiOperation(value = "Retrieve a zip of the content from a directory in the workspace", httpMethod = "GET", notes = "Get zip containing files from the workspace.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully produced a zip of the required workspace files") })
public Response getFiles(@QueryParam("workspace") String workspaceId, @QueryParam("serviceId") String serviceId, @QueryParam("dir") String dir) throws IOException {
    log.info("GET request for /workspace/files");
    String techWorkspaceDir = StarterUtil.getWorkspaceDir(workspaceId) + "/";
    String filesDir = techWorkspaceDir + "/" + serviceId + "/" + dir;
    File directory = new File(filesDir);
    if(directory.exists() && directory.isDirectory()) {
        IOFileFilter filter;
        if("swagger".equals(serviceId)) {
            filter = FileFilterUtils.notFileFilter(new NameFileFilter(new String[]{"RestApplication.java", "AndroidManifest.xml"}));
        } else {
            filter = FileFilterUtils.trueFileFilter();
        }
        Iterator<File> itr = FileUtils.iterateFilesAndDirs(directory, filter, FileFilterUtils.trueFileFilter());
        StreamingOutput so = (OutputStream os) -> {
            ZipOutputStream zos = new ZipOutputStream(os);
            while(itr.hasNext()) {
                File file = itr.next();
                if(file.isFile()) {
                    byte[] byteArray = FileUtils.readFileToByteArray(file);
                    String path = file.getAbsolutePath().replace('\\', '/');
                    int index = path.indexOf(serviceId + "/" + dir);
                    String relativePath = path.substring(index);
                    ZipEntry entry = new ZipEntry(relativePath);
                    entry.setSize(byteArray.length);
                    entry.setCompressedSize(-1);
                    try {
                        zos.putNextEntry(entry);
                        zos.write(byteArray);
                    } catch (IOException e) {
                        throw new IOException(e);
                    }
                }
            }
            zos.close();
        };
        log.info("Copied files from " + filesDir + " to zip.");
        return Response.ok(so, "application/zip").header("Content-Disposition", "attachment; filename=\"swagger.zip\"").build();
    } else {
        log.severe("File directory doesn't exist : " + filesDir);
        return Response.status(Status.BAD_REQUEST).entity("File directory specified doesn't exist").build();
    }
}
 
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:49,代码来源:WorkspaceEndpoint.java

示例10: RemoteRepositoryCollisionValidator

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public RemoteRepositoryCollisionValidator(String remoteRepositoryUrl, ChecksumProvider checksumProvider) {
    this(remoteRepositoryUrl, checksumProvider, FileFilterUtils.trueFileFilter(), 20);
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:4,代码来源:RemoteRepositoryCollisionValidator.java

示例11: RemoteRepositoryCompareValidator

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public RemoteRepositoryCompareValidator(String remoteRepositoryUrl, ChecksumProvider checksumProvider) {
    this(remoteRepositoryUrl, checksumProvider, FileFilterUtils.trueFileFilter(), 20);
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:4,代码来源:RemoteRepositoryCompareValidator.java

示例12: defaultFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Bean
public IOFileFilter defaultFilter() {
    return FileFilterUtils.trueFileFilter();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:5,代码来源:AbstractReporterTest.java

示例13: modelValidatorFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Bean
public IOFileFilter modelValidatorFilter() {
    return FileFilterUtils.trueFileFilter();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:5,代码来源:TestBomUnmanagedVersionValidator.java

示例14: bomUnmanagedVersionValidatorFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Bean
public IOFileFilter bomUnmanagedVersionValidatorFilter() {
    return FileFilterUtils.trueFileFilter();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:5,代码来源:TestBomUnmanagedVersionValidator.java

示例15: dependenciesValidatorFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Bean
public IOFileFilter dependenciesValidatorFilter() {
    return FileFilterUtils.trueFileFilter();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:5,代码来源:TestBomDependencyNotFoundValidator.java


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