Package java.nio.file

Examples of java.nio.file.WatchKey.pollEvents()


  @Override
  protected boolean pollEvents() throws Exception {
    // Take events, but don't care what they are!
    WatchKey watchKey = watchService.take();
   
    watchKey.pollEvents();
    watchKey.reset();
   
    // Events are always relevant; ignored paths are not monitored
    return true;
  }
View Full Code Here


            } catch (InterruptedException e) {
                throw new StLightException(e);
            }

            // Go through all the events
            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();
View Full Code Here

            key = watchService.take();
          } catch (InterruptedException e) {
            return;
          }

          for (WatchEvent<?> event : key.pollEvents()) {
            WatchEvent.Kind<?> kind = event.kind();

            if (kind == OVERFLOW) {
              continue;
            }
View Full Code Here

            while (true) {
                final WatchKey key = watchService.take();
                if(key == null){
                    continue;
                }
                for (WatchEvent<?> watchEvent : key.pollEvents()) {
                    final WatchEvent.Kind<?> kind = watchEvent.kind();
                    //忽略无效事件
                    if (kind == StandardWatchEventKinds.OVERFLOW) {
                        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.