Package java.nio.file

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


    {

        Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ), "tmpIndex" );
        if ( Files.exists( tmpIndexDir ) )
        {
            FileUtils.deleteDirectory( tmpIndexDir.toFile() );
        }
        String id = Long.toString( System.currentTimeMillis() );
        ManagedRepository managedRepository = new ManagedRepository();
        managedRepository.setId( id );
        managedRepository.setName( "name of " + id );
View Full Code Here


        throws Exception
    {
        Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ), "tmpIndex" );
        if ( Files.exists( tmpIndexDir ) )
        {
            FileUtils.deleteDirectory( tmpIndexDir.toFile() );
        }
        String id = Long.toString( System.currentTimeMillis() );
        ManagedRepository managedRepository = new ManagedRepository();
        managedRepository.setId( id );
        managedRepository.setName( "name of " + id );
View Full Code Here

       
        this.position = position;
       
        Properties BOARD_PROPERTIES = new Properties();
        Path propFile = Main.DIRECTORY.resolve("config").resolve("board.properties");
        try (FileInputStream is = new FileInputStream(propFile.toFile())) {
            BOARD_PROPERTIES.load(is);
        } catch (Exception e) {
            Main.LOG.log(Level.SEVERE, "Cannot load board properties", e);
        }
View Full Code Here

       
        @SuppressWarnings("unchecked")
        WatchEvent<Path> ev = (WatchEvent<Path>) event;
        Path name = ev.context();
        Path child = dir.resolve(name);
        File f = child.toFile();
        updateFile(event, f);
      }
     
      key.reset();
    }
View Full Code Here

 
  @Test
  public void testBasic() throws Exception {
    File in = getFile("in/basic.my.sql");
    Path out = convert(in);
    assertTrue("Failed to create main SQL file", out.toFile().exists());
  }
 
  @Test
  public void testData() throws Exception {
    File in = getFile("in/data.my.sql");
View Full Code Here

 
  @Test
  public void testData() throws Exception {
    File in = getFile("in/data.my.sql");
    Path out = convert(in);
    assertTrue("Failed to create main SQL file", out.toFile().exists());
    File expected = getFile("out/data.foo.csv");
    File actual = out.resolveSibling("foo.csv").toFile();
    assertFileEqual(expected, actual);
  }
View Full Code Here

    Path tmp = getTemporaryDirectory();
    if (tmp == null) {
      tmp = createDirInsideApplication();
    }
   
    return tmp.toFile();
  }

  protected Path getTemporaryDirectory() {
    try {
      Path tmp = Files.createTempFile("vraptor", "upload");
View Full Code Here

          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

    // From here use NIO 2
    Path filePathRef = Paths.get(f.toURI());
    // Do somes actions using "Files" new Helper and Path class
    System.out.printf("Final Parts of file path : %s\n", filePathRef.getName(filePathRef.getNameCount() - 2));
    UserPrincipal owner = Files.getOwner(filePathRef, LinkOption.NOFOLLOW_LINKS);
    System.out.printf("Owner of file '%s' is '%s'\n", filePathRef.toFile().getName(), owner.getName());
    FileStore store = Files.getFileStore(filePathRef);
    System.out.println("Storage infos");
    System.out.printf(">>> Store name is '%s'\n", store.name());
    System.out.printf(">>> Store is read-only '%s'\n", store.isReadOnly());
    System.out.printf(">>> Store type is '%s'\n", store.type());
View Full Code Here

            for (WatchEvent<?> event : key.pollEvents()) {
                WatchEvent<Path> pathEvent = (WatchEvent<Path>) event;

                // Check the path
                Path completePath = pathByKey.get(key).resolve(pathEvent.context());
                File completeFile = completePath.toFile();

                // Check the event
                WatchEvent.Kind<Path> kind = pathEvent.kind();
                if (StandardWatchEventKinds.OVERFLOW.equals(kind)) {
                    continue;
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.