Package java.nio.file

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


      System.out.println("Temp file : " + tempFile.getAbsolutePath());
      // nio style
      final Path path = Files.createTempFile("nio-temp", ".tmp");
      System.out.println("Temp file : " + path);
      //call the same delete on exit
      path.toFile().deleteOnExit();

      Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
          try {
            Files.delete(path);
View Full Code Here


    }

    protected static void savePidFile(final String pidFile) {
        final String pid = Tools.getPID();
        final Path pidFilePath = Paths.get(pidFile);
        pidFilePath.toFile().deleteOnExit();

        try {
            if (pid == null || pid.isEmpty() || pid.equals("unknown")) {
                throw new Exception("Could not determine PID.");
            }
View Full Code Here

            p.write("topic-" + (i % 10), ByteString.copyFromUtf8(1e9 + i + ""));
        }

        long t1 = System.currentTimeMillis();

        assertEquals(10, homeDir.toFile().list().length);

        int shortFileCount = 0;
        File[] topicFiles = homeDir.toFile().listFiles();
        assertNotNull(topicFiles);
        for (File topic : topicFiles) {
View Full Code Here

        long t1 = System.currentTimeMillis();

        assertEquals(10, homeDir.toFile().list().length);

        int shortFileCount = 0;
        File[] topicFiles = homeDir.toFile().listFiles();
        assertNotNull(topicFiles);
        for (File topic : topicFiles) {
            assertTrue(topic.getName().matches("topic-[0-9]+"));
            File[] files = topic.listFiles();
            assertNotNull(files);
View Full Code Here

            @Override
            public List<String> getOutputFields() {
                throw new UnsupportedOperationException("Default operation");
            }
        }, statusPath.toFile(), new File(homeDir.toFile(), "topic-1"), Pattern.compile("[0-9a-f]*"));

        final List<List<Object>> tuples = Lists.newArrayList();
        SpoutOutputCollector collector = new SpoutOutputCollector(null) {
            @Override
            public List<Integer> emit(List<Object> tuple) {
View Full Code Here

*/
public class InvertUtils {
  public Path getPath(String name) {
    FileSystem fs = FileSystems.getDefault();
    Path path = fs.getPath(name);
    if (path.toFile().exists()) {
      return path;
    } else {
      return fs.getPath("compiler/" + name);
    }
  }
View Full Code Here

        cmdDir.resolve("../src/druntime/import"),
        cmdDir.resolve("../src/phobos"));
    }
    // another MacOSX layout
    Path resolvedCmdPath = cmdDir.resolve("../share/dmd/bin/dmd");
    if(resolvedCmdPath.toFile().exists()) {
      Path resolvedCmdDir = resolvedCmdPath.getParent();
      if(resolvedCmdDir.resolve("../src/druntime").toFile().exists()) {
        return new CompilerInstall(resolvedCmdPath, ECompilerType.DMD,
          resolvedCmdDir.resolve("../src/druntime/import"),
          resolvedCmdDir.resolve("../src/phobos"));
View Full Code Here

    /*
     * and clean, if new session started and data should be zero
     */
    if (pp.isUsingEmptyStorage()) {
      logger.info("Cleaning storage folder...");
      deleteDirectory(path.toFile());
    }
    /*
     * create directory
     */

 
View Full Code Here

            .toPath();

        File src = FileUtil.createTempDirectory("DeployerCanonicalPathTest", ".src", null);

        Path parent = root.resolve("parent");
        parent.toFile().mkdirs();

        try {
            File destination = null;

            try {
View Full Code Here

    {
        super.tearDown();
        Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ), "tmpIndex" );
        if ( Files.exists( tmpIndexDir ) )
        {
            FileUtils.deleteDirectory( tmpIndexDir.toFile() );
        }
    }


    protected String createAndScanRepo()
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.