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


Java Path.subpath方法代码示例

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


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

示例1: notifyChangedEditedFile

import java.nio.file.Path; //导入方法依赖的package包/类
/**
 * Notify about changed the edited file.
 *
 * @param prevFile the prev file.
 * @param newFile  the new file.
 */
@FXThread
private void notifyChangedEditedFile(final @NotNull Path prevFile, final @NotNull Path newFile) {

    final Path editFile = getEditFile();

    if (editFile.equals(prevFile)) {
        setEditFile(newFile);
        return;
    }

    if (!editFile.startsWith(prevFile)) return;

    final Path relativeFile = editFile.subpath(prevFile.getNameCount(), editFile.getNameCount());
    final Path resultFile = newFile.resolve(relativeFile);

    setEditFile(resultFile);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:24,代码来源:AbstractFileEditor.java

示例2: mergeDifferences

import java.nio.file.Path; //导入方法依赖的package包/类
private Path mergeDifferences(Path path, Path newPath) {
    int start = newPath.relativize(path).getNameCount();
    int end = path.getNameCount();
    Path subPath = path.subpath(start, end);

    return newPath.resolve(subPath);
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:8,代码来源:TabUpdater.java

示例3: getBundleSubDir

import java.nio.file.Path; //导入方法依赖的package包/类
private String getBundleSubDir(final Path relChangedDir) {
    if (relChangedDir.getNameCount() == 1) {
        return StringUtils.EMPTY;
    }
    final Path subPath = relChangedDir.subpath(1, relChangedDir.getNameCount());
    // ensure that we use '/' as the JCR path separator, even if the filesystem path uses something else
    return StringUtils.join(subPath.iterator(), '/');
}
 
开发者ID:openweb-nl,项目名称:hippo-groovy-updater,代码行数:9,代码来源:GroovyFilesWatcher.java

示例4: testExtractFromDir

import java.nio.file.Path; //导入方法依赖的package包/类
public void testExtractFromDir() {
    Path imagePath = Paths.get(getImagePath());
    Path imageDirPath = imagePath.subpath(0, imagePath.getNameCount() - 1);
    jimage("extract", imageDirPath.toString())
            .assertFailure()
            .assertShowsError();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:JImageExtractTest.java

示例5: fillChildren

import java.nio.file.Path; //导入方法依赖的package包/类
@FXThread
private void fillChildren(@NotNull final Path prevFile, @NotNull final Path newFile,
                          @NotNull final Array<TreeItem<ResourceElement>> children) {
    for (final TreeItem<ResourceElement> child : children) {

        final ResourceElement resourceElement = child.getValue();
        final Path file = resourceElement.getFile();
        final Path relativeFile = file.subpath(prevFile.getNameCount(), file.getNameCount());
        final Path resultFile = newFile.resolve(relativeFile);

        child.setValue(createFor(resultFile));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:14,代码来源:ResourceTree.java

示例6: createOutputDirectoryTree

import java.nio.file.Path; //导入方法依赖的package包/类
/**
 * Creates the directory tree in {@link CleanupSettings#getOutputBaseDirectory()} using the given path. The given
 * path will be stripped from the root directory. The parent directories of the target file will be created if the
 * tree does not exist.
 * <p>
 * Example: {@code mediaSource} is "0/subdir/file.ext". The base output dir is assumed to be "output". The return
 * value results in being "output/subdir/file.ext", where "output/subdir" will be created. The file itself will NOT
 * be created.
 * </p>
 *
 * @param mediaSource the media source, which requires at least 1 parent element.
 * @return the target as described.
 */
Path createOutputDirectoryTree(Path mediaSource) {

    Path relativeParent = mediaSource.subpath(1, mediaSource.getNameCount());
    Path target = cleanupSettings.getOutputBaseDirectory().resolve(relativeParent);
    FileUtil.createParentDirectoriesFor(target);
    return target;
}
 
开发者ID:ccremer,项目名称:clustercode,代码行数:21,代码来源:StructuredOutputDirectoryProcessor.java


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