Package java.nio.file

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


          IOUtil.class.getName(),
          IOUtil.tempFileCounter++,
          System.currentTimeMillis())
          , "tmp");
           
      tempPath.toFile().deleteOnExit();
     
      return tempPath;
    } catch (Exception ex) {
      throw new JuException("Couldn't create temporary file", ex);
    }
View Full Code Here


        // Get stats
        Iterator<Path> dataFiles = Files.newDirectoryStream(streamDirectory, "out-*").iterator();
        Path lastPath = dataFiles.next();
        long nextBlockPosition = 0;
        RandomAccessFile input = new RandomAccessFile(lastPath.toFile(), "r");
        while (true) {
            if (nextBlockPosition != 0) {
                input.seek(nextBlockPosition);
            }
            if (input.getFilePointer() >= input.length()) {
View Full Code Here

                if (!dataFiles.hasNext()) {
                    log.info("ran out of mux data files after : " + lastPath.toString());
                    break;
                }
                lastPath = dataFiles.next();
                input = new RandomAccessFile(lastPath.toFile(), "r");
                nextBlockPosition = 0;
            }
            // parse the next block
            int countIDs = input.readShort();
            chunks += countIDs;
View Full Code Here

        if (template.isPresent())
        {
            try
            {
                Path tempFile = Files.createTempFile(scriptName.get(), ".tmp");
                Writer out = new FileWriter(tempFile.toFile());
                template.get().process(templateDataModel, out);
                out.close();
                log.info("Processed template in " + tempFile.toString());
                temporaryFile = true;
                path = Optional.of(tempFile);
View Full Code Here

      Path path = MiscUtil.createPathOrNull(pathString);
      if(path == null) {
        handleWarning("Invalid path: " + pathString + " in env variable: " + envVarName);
        continue;
      }
      if(!path.toFile().isDirectory()) {
        continue;
      }
      searchPathEntry(path);
    }
  }
View Full Code Here

  public IFileHandle directoryHasCompilerPresent(Path exeDir) {
    String possibleCompilerExeNames[] = getPossibleInterpreterNames();
   
    for (String possibleCompilerExeName : possibleCompilerExeNames) {
      Path compileExeLocation = exeDir.resolve(possibleCompilerExeName);
      if(compileExeLocation.toFile().isFile()) {
        return LocalEnvironment.getInstance().getFile(compileExeLocation.toUri());
      }
      // Try .exe extension. Note, it is intentional that both extensions are checked regardless of
      // what actual platform we are on.
      compileExeLocation = exeDir.resolve(possibleCompilerExeName + ".exe");
View Full Code Here

        return LocalEnvironment.getInstance().getFile(compileExeLocation.toUri());
      }
      // Try .exe extension. Note, it is intentional that both extensions are checked regardless of
      // what actual platform we are on.
      compileExeLocation = exeDir.resolve(possibleCompilerExeName + ".exe");
      if(compileExeLocation.toFile().isFile()) {
        return LocalEnvironment.getInstance().getFile(compileExeLocation.toUri());
      }
    }
   
    return null;
View Full Code Here

 
  public static ProcessBuilder createProcessBuilder(IProject project, String... commands) {
    Path workingDir = project != null ?
      project.getLocation().toFile().toPath() :
      EclipseUtils.getWorkspaceRoot().getLocation().toFile().toPath();
    return new ProcessBuilder(commands).directory(workingDir.toFile());
  }
 
  public class RunDubProcessOperation extends AbstractRunProcessTask implements IDubOperation{
   
    protected final String operationName;
View Full Code Here

        // immediately after we close our titan connection.
        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    FileUtils.deleteDirectory(esDir.toFile());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }));
View Full Code Here

                  return;
                }
              }

              // Record changed files.
              changedFiles.add(changedPath.toFile().getAbsoluteFile());
            }

            // Ensures that future change events will be seen.
            if (!watchKey.reset()) {
              pathsByWatchKey.remove(watchKey);
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.