Package java.nio.file

Examples of java.nio.file.Path


        super();
       
        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


            }
        }
    }

    public String readSymbolicLink() throws IOException {
        Path path = file.toPath();
        Path link = Files.readSymbolicLink(path);
        return link.toString();
    }
View Full Code Here

        Path link = Files.readSymbolicLink(path);
        return link.toString();
    }

    public void createSymbolicLink(SshFile destination) throws IOException {
        Path link = file.toPath();
        Path target = Paths.get(destination.getAbsolutePath());
        Files.createSymbolicLink(target, link);
    }
View Full Code Here

import org.eclipse.jgit.util.SystemReader;

class FileUtil {

  static String readSymlink(File path) throws IOException {
    Path nioPath = path.toPath();
    Path target = Files.readSymbolicLink(nioPath);
    String targetString = target.toString();
    if (SystemReader.getInstance().isWindows())
      targetString = targetString.replace('\\', '/');
    else if (SystemReader.getInstance().isMacOS())
      targetString = Normalizer.normalize(targetString, Form.NFC);
    return targetString;
View Full Code Here

    return targetString;
  }

  public static void createSymLink(File path, String target)
      throws IOException {
    Path nioPath = path.toPath();
    if (Files.exists(nioPath, LinkOption.NOFOLLOW_LINKS))
      Files.delete(nioPath);
    if (SystemReader.getInstance().isWindows())
      target = target.replace('/', '\\');
    Path nioTarget = new File(target).toPath();
    Files.createSymbolicLink(nioPath, nioTarget);
  }
View Full Code Here

    Path nioTarget = new File(target).toPath();
    Files.createSymbolicLink(nioPath, nioTarget);
  }

  public static boolean isSymlink(File path) {
    Path nioPath = path.toPath();
    return Files.isSymbolicLink(nioPath);
  }
View Full Code Here

    Path nioPath = path.toPath();
    return Files.isSymbolicLink(nioPath);
  }

  public static long lastModified(File path) throws IOException {
    Path nioPath = path.toPath();
    return Files.getLastModifiedTime(nioPath, LinkOption.NOFOLLOW_LINKS)
        .toMillis();
  }
View Full Code Here

    return Files.getLastModifiedTime(nioPath, LinkOption.NOFOLLOW_LINKS)
        .toMillis();
  }

  public static void setLastModified(File path, long time) throws IOException {
    Path nioPath = path.toPath();
    Files.setLastModifiedTime(nioPath, FileTime.fromMillis(time));
  }
View Full Code Here

    Path nioPath = path.toPath();
    Files.setLastModifiedTime(nioPath, FileTime.fromMillis(time));
  }

  public static boolean exists(File path) {
    Path nioPath = path.toPath();
    return Files.exists(nioPath, LinkOption.NOFOLLOW_LINKS);
  }
View Full Code Here

    Path nioPath = path.toPath();
    return Files.exists(nioPath, LinkOption.NOFOLLOW_LINKS);
  }

  public static boolean isHidden(File path) throws IOException {
    Path nioPath = path.toPath();
    return Files.isHidden(nioPath);
  }
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.