Package java.nio.file

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


    @Override
    public void run() {
        try {
            Path dir = Paths.get(System.getProperty("karaf.etc"));
            dir.register(watchService, ENTRY_MODIFY);

            Path file = dir.resolve("users.properties");
            encryptedPassword(new Properties(file.toFile()));

            while (true) {
View Full Code Here


    FileSystem fileSystem = directory.getFileSystem();

    WatchService watcher = fileSystem.newWatchService();

    try {
      WatchKey key = directory.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE);
      if(key.isValid()){
        process(key);
      }

      while(key.reset()){
View Full Code Here

      try {
        watchService = toWatch.getFileSystem().newWatchService();
        WatchQueueReader reader = new WatchQueueReader(watchService, toWatch);
        Thread qr = new Thread(reader, "Dir Watcher");
        qr.start();
        toWatch.register(watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE);
      } catch (IOException e) {
        logger.error("Cannot activate folder watcher for folder '{}': ", toWatch, e);
      }
    }
  }
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.