equal
deleted
inserted
replaced
462 // Translate file change action into watch event |
462 // Translate file change action into watch event |
463 private WatchEvent.Kind<?> translateActionToEvent(int action) |
463 private WatchEvent.Kind<?> translateActionToEvent(int action) |
464 { |
464 { |
465 switch (action) { |
465 switch (action) { |
466 case FILE_ACTION_MODIFIED : |
466 case FILE_ACTION_MODIFIED : |
467 return StandardWatchEventKind.ENTRY_MODIFY; |
467 return StandardWatchEventKinds.ENTRY_MODIFY; |
468 |
468 |
469 case FILE_ACTION_ADDED : |
469 case FILE_ACTION_ADDED : |
470 case FILE_ACTION_RENAMED_NEW_NAME : |
470 case FILE_ACTION_RENAMED_NEW_NAME : |
471 return StandardWatchEventKind.ENTRY_CREATE; |
471 return StandardWatchEventKinds.ENTRY_CREATE; |
472 |
472 |
473 case FILE_ACTION_REMOVED : |
473 case FILE_ACTION_REMOVED : |
474 case FILE_ACTION_RENAMED_OLD_NAME : |
474 case FILE_ACTION_RENAMED_OLD_NAME : |
475 return StandardWatchEventKind.ENTRY_DELETE; |
475 return StandardWatchEventKinds.ENTRY_DELETE; |
476 |
476 |
477 default : |
477 default : |
478 return null; // action not recognized |
478 return null; // action not recognized |
479 } |
479 } |
480 } |
480 } |
546 |
546 |
547 // ReadDirectoryChangesW failed |
547 // ReadDirectoryChangesW failed |
548 if (info.error() != 0) { |
548 if (info.error() != 0) { |
549 // buffer overflow |
549 // buffer overflow |
550 if (info.error() == ERROR_NOTIFY_ENUM_DIR) { |
550 if (info.error() == ERROR_NOTIFY_ENUM_DIR) { |
551 key.signalEvent(StandardWatchEventKind.OVERFLOW, null); |
551 key.signalEvent(StandardWatchEventKinds.OVERFLOW, null); |
552 } else { |
552 } else { |
553 // other error so cancel key |
553 // other error so cancel key |
554 implCancelKey(key); |
554 implCancelKey(key); |
555 key.signal(); |
555 key.signal(); |
556 } |
556 } |
560 // process the events |
560 // process the events |
561 if (info.bytesTransferred() > 0) { |
561 if (info.bytesTransferred() > 0) { |
562 processEvents(key, info.bytesTransferred()); |
562 processEvents(key, info.bytesTransferred()); |
563 } else { |
563 } else { |
564 // insufficient buffer size |
564 // insufficient buffer size |
565 key.signalEvent(StandardWatchEventKind.OVERFLOW, null); |
565 key.signalEvent(StandardWatchEventKinds.OVERFLOW, null); |
566 } |
566 } |
567 |
567 |
568 // start read for next batch of changes |
568 // start read for next batch of changes |
569 try { |
569 try { |
570 ReadDirectoryChangesW(key.handle(), |
570 ReadDirectoryChangesW(key.handle(), |