Package java.nio.file

Examples of java.nio.file.Path.resolve()


    Set<Path> results = new HashSet<>();
    results.add(path);
    if (path.isAbsolute()) {
      results.add(workingDir.relativize(path));
    } else {
      results.add(workingDir.resolve(path));
    }
    if (directory) {
      for (Path p : ImmutableList.copyOf(results)) {
        results.add(p.resolve("."));
        results.add(p.resolve(".").resolve("."));
View Full Code Here


  private void assertResolvedPathEquals(String expected, Path path, String firstResolvePath,
      String... moreResolvePaths) {
    Path resolved = path.resolve(firstResolvePath);
    for (String additionalPath : moreResolvePaths) {
      resolved = resolved.resolve(additionalPath);
    }
    assertPathEquals(expected, resolved);

    Path relative = pathService.parsePath(firstResolvePath, moreResolvePaths);
    resolved = path.resolve(relative);
View Full Code Here

                Path path = outDir;
               
                // split path string and assemble path
                String[] names = StringUtils.split(pathString, '/');
                for (String name : names) {
                    path = path.resolve(FilenameSanitizer.sanitizeName(name));
                }
               
                L.log(Level.INFO, "{0}{1}{2}", new Object[]{file.toString(), file.getFileSystem().getSeparator(), pathString});

                // load asset
View Full Code Here

                Path siblingDir = null;
                if (sibling != null && sibling instanceof PathFileObject) {
                    siblingDir = ((PathFileObject) sibling).getPath().getParent();
                }
                return PathFileObject.createSiblingPathFileObject(this,
                        siblingDir.resolve(getBaseName(relativePath)),
                        relativePath);
            } else if (location == SOURCE_OUTPUT) {
                dir = getOutputLocation(CLASS_OUTPUT);
            }
        }
View Full Code Here

        hash = MD5.fromString(metaFile.getHash());
      final List<TorrentPiece> filePieces = getPieces(Range
          .getRangeByLength(offset, metaFile.getLength()));
      final TorrentFile file = new TorrentFile(this, offset,
          metaFile.getLength(), filePieces,
          torrentPath.resolve(metaFile.getFileName()), hash);
      files.add(file);
      for (final TorrentPiece piece : filePieces) {
        piece.addFile(file);
      }
      offset += metaFile.getLength();
View Full Code Here

            TransformerFactory factory = new TransformerFactoryImpl();
            File xslFile = configPath.resolve("docbook/epub3/chunk.xsl").toFile();
            StreamSource xslSource = new StreamSource(xslFile);
            Transformer transformer = factory.newTransformer(xslSource);
            transformer.setParameter("base.dir", epubTemp.resolve("OEBPS").toString());
            StreamSource xmlSource = new StreamSource(currentPath.resolve("book.xml").toFile());
            transformer.transform(xmlSource, new StreamResult());

            Path containerXml = epubTemp.resolve("META-INF/container.xml");
View Full Code Here

      boolean shouldDelete = events.stream()
        .map(WatchEvent::kind)
        .anyMatch(ENTRY_DELETE::equals);
      events.stream()
        .map(e -> (WatchEvent<Path>) e)
        .peek(e -> out.println("> " + dir.resolve(e.context()).getFileName()))
        .filter(e -> e.kind()==ENTRY_CREATE)
        .map(e -> e.context())
        .map(name -> dir.resolve(name))
        .filter(path -> isDirectory(path, NOFOLLOW_LINKS))
        .forEach(this::registerAll);
View Full Code Here

      events.stream()
        .map(e -> (WatchEvent<Path>) e)
        .peek(e -> out.println("> " + dir.resolve(e.context()).getFileName()))
        .filter(e -> e.kind()==ENTRY_CREATE)
        .map(e -> e.context())
        .map(name -> dir.resolve(name))
        .filter(path -> isDirectory(path, NOFOLLOW_LINKS))
        .forEach(this::registerAll);

      if(shouldDelete) compiler.clear();
      compiler.compileAll();
View Full Code Here

                Files2.untgz(tmpFile, jvmFolder);
            } else {
                throw new IllegalStateException("Unsupported JVM url, expected suffix '.zip', '.tgz' or '.tar.gz'");
            }

            if (Files.exists(jvmFolder.resolve("bin/java"))) {
                return jvmFolder;
            }

            Path childDir;
            try {
View Full Code Here

                childDir = Files2.findUniqueChildDirectory(jvmFolder);

            } catch (RuntimeException e) {
                throw new IllegalStateException("JAVA_HOME with JAVA_HOME/bin/java not found in " + jvmPackageUrl, e);
            }
            if (Files.exists(childDir.resolve("bin/java"))) {
                return childDir;
            }
            throw new IllegalStateException("JAVA_HOME with JAVA_HOME/bin/java not found in dir " + childDir.getFileName() + " of " + jvmPackageUrl);
        } finally {
            Files.delete(tmpFile);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.