Package java.nio.file

Examples of java.nio.file.Path


  protected static String getExecutableSuffix() {
    return MiscUtil.OS_IS_WINDOWS ? ".exe" : "";
  }
 
  public Path getEffectiveTargetFullPath() {
    Path path = MiscUtil.createPathOrNull(getTargetPath() == null ? "" : getTargetPath());
    if(path == null) {
      path = Paths.get("");
    }
    return path.resolve(getEffectiveTargetName());
  }
View Full Code Here


 
  @Override
  protected void writeResponseJsonContents() throws IOException, GenieCommandException {
    System.out.println(StringUtil.collToString(commandArguments.entrySet(), "\n"));
   
    Path modulePath = getPath(commandArguments, "filepath");
    int offset = getInt(commandArguments, "offset");
   
    FindDefinitionResult cmdResult = getDToolServer().doFindDefinition(modulePath, offset);
   
    if(cmdResult.errorMessage != null) {
View Full Code Here

    return getPath(map, propName, true);
  }
 
  protected Path getPath(Map<String, Object> map, String propName, boolean allowNull) throws EXC {
    String pathString = getValue(map, propName, String.class, allowNull);
    Path path = pathString == null ? null : MiscUtil.createPathOrNull(pathString);
    if(path == null) {
      if(allowNull)
        return null;
      throw validationError("Invalid path: " + pathString);
    }
View Full Code Here

      throw handleArgumentsError("Argument not integer: " + stringArg);
    }
  }
 
  protected Path parseValidPath(String stringArgument) {
    Path path = MiscUtil.createPathOrNull(stringArgument);
    if(path == null) {
      throw handleArgumentsError("Invalid path : " + stringArgument);
    }
    return path;
  }
View Full Code Here

    // return "C:\\ugate\\" +
    // UGateUtil.calFormat(getCreated()).replaceAll(":", "-") + '.' +
    // getImageExtension();
    final String imgFileName = getCreatedTimeString().replaceAll(":", "-")
        + '.' + getImageExtension();
    final Path imgRootPath = RS.workingDirectoryPath(
        Paths.get(getRemoteNode().getWorkingDir()), null);
    return Paths.get(imgRootPath.toAbsolutePath().toString(), imgFileName);
  }
View Full Code Here

          "Image has already been written to path %1$s at %2$s",
          getImagePath(), UGateUtil.calFormat(endTime)));
    }
    try {
      final ByteBuffer byteBuffer = getBytes();
      final Path filePath = getImagePath();
      writeImage(byteBuffer.array(), filePath);
      endTime = Calendar.getInstance();
      if (log.isInfoEnabled()) {
        log.info(String
            .format("Wrote (%1$s) bytes from (%2$s) image chunks to \"%3$s\" (took: %4$s)",
View Full Code Here

 
  /**
   * Loads a resource of the current class into a {@link JavaFileObject}.
   */
  public JavaFileObject source(Class<?> clazz, String fileName) {
    Path path = fileSystem.getPath("/", clazz.getPackage().getName().replace('.', '/'), fileName);
    try {
      Files.createDirectories(path.getParent());
      try (InputStream inputStream = clazz.getResourceAsStream(fileName)) {
        Files.copy(inputStream, path);
      }
    } catch (IOException e) {
      throw new AssertionError(e);
View Full Code Here

   */
  public JavaFileObject forSourceLines(String fileName, String... lines) {
    if (!fileName.startsWith("/")) {
      fileName = "/" + fileName;
    }
    Path path = fileSystem.getPath(fileName);
    try {
      Files.createDirectories(path.getParent());
      Files.write(path, Arrays.asList(lines), UTF_8);
    } catch (IOException e) {
      throw new AssertionError(e);
    }
    return Iterables.getOnlyElement(getJavaFileObjects(path));
View Full Code Here

    {
      List<WatchEvent<?>> events = watchKey.pollEvents();
      for (WatchEvent<?> event : events)
      {
        WatchEvent.Kind<?> eventKind = event.kind();
        Path eventPath = (Path) event.context();

        if (eventKind == ENTRY_CREATE)
        {
          entryCreated(eventPath, log);
        }
View Full Code Here

    String[] classPathEntries = Strings.split(classpath, File.pathSeparatorChar);
    for (String classPathEntry : classPathEntries)
    {
      if (classPathEntry.endsWith(".jar") == false)
      {
        Path folder = Paths.get(classPathEntry);
        if (Files.isDirectory(folder))
        {
          register(folder, watchService);

          Files.walkFileTree(folder, new SimpleFileVisitor<Path>() {
View Full Code Here

TOP

Related Classes of java.nio.file.Path

Copyright © 2018 www.massapicom. 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.