• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RelativePath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited, preserveSpec);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:SyncCopyActionDecorator.java


示例2: execute

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:SyncCopyActionDecorator.java


示例3: doVisit

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
private void doVisit(FileVisitor visitor, File file, LinkedList<String> relativePath, int segmentIndex, AtomicBoolean stopFlag) {
    if (stopFlag.get()) {
        return;
    }

    String segment = patternSegments.get(segmentIndex);

    if (segment.contains("**")) {
        PatternSet patternSet = new PatternSet();
        patternSet.include(includePattern);
        patternSet.exclude(excludeSpec);
        DirectoryFileTree fileTree = new DirectoryFileTree(baseDir, patternSet);
        fileTree.visitFrom(visitor, file, new RelativePath(file.isFile(), relativePath.toArray(new String[relativePath.size()])));
    } else if (segment.contains("*") || segment.contains("?")) {
        PatternStep step = PatternStepFactory.getStep(segment, false);
        File[] children = file.listFiles();
        if (children == null) {
            if (!file.canRead()) {
                throw new GradleException(String.format("Could not list contents of directory '%s' as it is not readable.", file));
            }
            // else, might be a link which points to nothing, or has been removed while we're visiting, or ...
            throw new GradleException(String.format("Could not list contents of '%s'.", file));
        }
        for (File child : children) {
            if (stopFlag.get()) {
                break;
            }
            String childName = child.getName();
            if (step.matches(childName)) {
                relativePath.addLast(childName);
                doVisitDirOrFile(visitor, child, relativePath, segmentIndex + 1, stopFlag);
                relativePath.removeLast();
            }
        }
    } else {
        relativePath.addLast(segment);
        doVisitDirOrFile(visitor, new File(file, segment), relativePath, segmentIndex + 1, stopFlag);
        relativePath.removeLast();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:41,代码来源:SingleIncludePatternFileTree.java


示例4: transform

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public File transform(RelativePath relativePath) {
    String sourceFileName = relativePath.getLastName();

    String destinationFileNameBase = sourceFileName;
    if (sourceFileName.endsWith(".coffee")) {
        destinationFileNameBase = sourceFileName.substring(0, sourceFileName.length() - 7);
    }

    String destinationFileName = destinationFileNameBase + ".js";
    RelativePath destinationRelativePath = relativePath.replaceLastName(destinationFileName);
    return new File(destination, destinationRelativePath.getPathString());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:CoffeeScriptCompileDestinationCalculator.java


示例5: asFactory

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public static Transformer<Transformer<File, RelativePath>, File> asFactory() {
    return new Transformer<Transformer<File, RelativePath>, File>() {
        public Transformer<File, RelativePath> transform(File original) {
            return new CoffeeScriptCompileDestinationCalculator(original);
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:CoffeeScriptCompileDestinationCalculator.java


示例6: createSpec

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
protected Spec<FileTreeElement> createSpec(Collection<String> patterns, boolean include, boolean caseSensitive) {
    if (patterns.isEmpty()) {
        return include ? Specs.<FileTreeElement>satisfyAll() : Specs.<FileTreeElement>satisfyNone();
    }

    List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>(patterns.size());
    for (String pattern : patterns) {
        Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(include, caseSensitive, pattern);
        matchers.add(patternMatcher);
    }

    return new RelativePathSpec(Specs.union(matchers));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:PatternSpecFactory.java


示例7: isSatisfiedBy

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public boolean isSatisfiedBy(RelativePath element) {
    if (element.isFile() || !partialMatchDirs) {
        return pathMatcher.matches(element.getSegments(), 0);
    } else {
        return pathMatcher.isPrefix(element.getSegments(), 0);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:PatternMatcherFactory.java


示例8: DefaultFileVisitDetails

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public DefaultFileVisitDetails(File file, RelativePath relativePath, AtomicBoolean stop, Chmod chmod, Stat stat, boolean isDirectory, long lastModified, long size) {
    super(file, relativePath, chmod, stat);
    this.stop = stop;
    this.isDirectory = isDirectory;
    this.lastModified = lastModified;
    this.size = size;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultFileVisitDetails.java


示例9: getFilesWithoutCreating

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public Set<File> getFilesWithoutCreating() {
    return CollectionUtils.collect(elements.keySet(), new Transformer<File, RelativePath>() {
        @Override
        public File transform(RelativePath relativePath) {
            return createFileInstance(relativePath);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:MapFileTree.java


示例10: visitDirs

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
private void visitDirs(RelativePath path, FileVisitor visitor) {
    if (path == null || path.getParent() == null || !visitedDirs.add(path)) {
        return;
    }

    visitDirs(path.getParent(), visitor);
    visitor.visitDir(new FileVisitDetailsImpl(path, null, stopFlag, chmod));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:MapFileTree.java


示例11: FileVisitDetailsImpl

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public FileVisitDetailsImpl(RelativePath path, Action<OutputStream> generator, AtomicBoolean stopFlag, Chmod chmod) {
    super(chmod);
    this.path = path;
    this.generator = generator;
    this.stopFlag = stopFlag;
    this.isDirectory = !path.isFile();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:MapFileTree.java


示例12: contains

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public static boolean contains(FileSystem fileSystem, DirectoryTree tree, File file) {
    String prefix = tree.getDir().getAbsolutePath() + File.separator;
    if (!file.getAbsolutePath().startsWith(prefix)) {
        return false;
    }

    RelativePath path = RelativePath.parse(true, file.getAbsolutePath().substring(prefix.length()));
    return tree.getPatterns().getAsSpec().isSatisfiedBy(new DefaultFileTreeElement(file, path, fileSystem, fileSystem));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DirectoryTrees.java


示例13: walkDir

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
@Override
public void walkDir(File file, RelativePath path, FileVisitor visitor, Spec<? super FileTreeElement> spec, AtomicBoolean stopFlag, boolean postfix) {
    File[] children = file.listFiles();
    if (children == null) {
        if (file.isDirectory() && !file.canRead()) {
            throw new GradleException(String.format("Could not list contents of directory '%s' as it is not readable.", file));
        }
        // else, might be a link which points to nothing, or has been removed while we're visiting, or ...
        throw new GradleException(String.format("Could not list contents of '%s'.", file));
    }
    List<FileVisitDetails> dirs = new ArrayList<FileVisitDetails>();
    for (int i = 0; !stopFlag.get() && i < children.length; i++) {
        File child = children[i];
        boolean isFile = child.isFile();
        RelativePath childPath = path.append(isFile, child.getName());
        FileVisitDetails details = new DefaultFileVisitDetails(child, childPath, stopFlag, fileSystem, fileSystem, !isFile);
        if (DirectoryFileTree.isAllowed(details, spec)) {
            if (isFile) {
                visitor.visitFile(details);
            } else {
                dirs.add(details);
            }
        }
    }

    // now handle dirs
    for (int i = 0; !stopFlag.get() && i < dirs.size(); i++) {
        FileVisitDetails dir = dirs.get(i);
        if (postfix) {
            walkDir(dir.getFile(), dir.getRelativePath(), visitor, spec, stopFlag, postfix);
            visitor.visitDir(dir);
        } else {
            visitor.visitDir(dir);
            walkDir(dir.getFile(), dir.getRelativePath(), visitor, spec, stopFlag, postfix);
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:38,代码来源:DefaultDirectoryWalker.java


示例14: visitFrom

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
/**
 * Process the specified file or directory.  If it is a directory, then its contents
 * (but not the directory itself) will be checked with {@link #isAllowed(FileTreeElement, Spec)} and notified to
 * the listener.  If it is a file, the file will be checked and notified.
 */
public void visitFrom(FileVisitor visitor, File fileOrDirectory, RelativePath path) {
    AtomicBoolean stopFlag = new AtomicBoolean();
    Spec<FileTreeElement> spec = patternSet.getAsSpec();
    if (fileOrDirectory.exists()) {
        if (fileOrDirectory.isFile()) {
            processSingleFile(fileOrDirectory, visitor, spec, stopFlag);
        } else {
            walkDir(fileOrDirectory, path, visitor, spec, stopFlag);
        }
    } else {
        LOGGER.info("file or directory '{}', not found", fileOrDirectory);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:DirectoryFileTree.java


示例15: processSingleFile

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
private void processSingleFile(File file, FileVisitor visitor, Spec<FileTreeElement> spec, AtomicBoolean stopFlag) {
    RelativePath path = new RelativePath(true, file.getName());
    FileVisitDetails details = new DefaultFileVisitDetails(file, path, stopFlag, fileSystem, fileSystem, false);
    if (isAllowed(details, spec)) {
        visitor.visitFile(details);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DirectoryFileTree.java


示例16: getRelativePath

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public RelativePath getRelativePath() {
    if (relativePath == null) {
        RelativePath path = fileDetails.getRelativePath();
        relativePath = specResolver.getDestPath().append(path.isFile(), path.getSegments());
    }
    return relativePath;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultFileCopyDetails.java


示例17: filesNotMatching

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public CopySpec filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
    if (!patterns.iterator().hasNext()) {
        throw new InvalidUserDataException("must provide at least one pattern to not match");
    }
    List<Spec> matchers = new ArrayList<Spec>();
    for (String pattern : patterns) {
        matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern));
    }
    Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()]));
    return eachFile(new MatchingCopyAction(Specs.<RelativePath>negate(unionMatcher), action));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultCopySpec.java


示例18: execute

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public void execute(FileCopyDetails fileCopyDetails) {
    RelativePath path = fileCopyDetails.getRelativePath();
    String newName = transformer.transform(path.getLastName());
    if (newName != null) {
        path = path.replaceLastName(newName);
        fileCopyDetails.setRelativePath(path);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:RenamingCopyAction.java


示例19: execute

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visitedFiles = new HashSet<RelativePath>();

    return delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    if (!details.isDirectory()) {
                        DuplicatesStrategy strategy = details.getDuplicatesStrategy();

                        if (!visitedFiles.add(details.getRelativePath())) {
                            if (strategy == DuplicatesStrategy.EXCLUDE) {
                                return;
                            } else if (strategy == DuplicatesStrategy.FAIL) {
                                throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath()));
                            } else if (strategy == DuplicatesStrategy.WARN) {
                                LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath());
                            }
                        }
                    }

                    action.processFile(details);
                }
            });
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:28,代码来源:DuplicateHandlingCopyActionDecorator.java


示例20: SyncCopyActionDecoratorFileVisitor

import org.gradle.api.file.RelativePath; //导入依赖的package包/类
private SyncCopyActionDecoratorFileVisitor(Set<RelativePath> visited, PatternFilterable preserveSpec) {
    this.visited = visited;
    PatternSet preserveSet = new PatternSet();
    if (preserveSpec != null) {
        preserveSet.include(preserveSpec.getIncludes());
        preserveSet.exclude(preserveSpec.getExcludes());
    }
    this.preserveSet = preserveSet;
    this.preserveSpec = preserveSet.getAsSpec();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:SyncCopyActionDecorator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Default类代码示例发布时间:2022-05-22
下一篇:
Java Subscription类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap