当前位置: 首页>>代码示例>>Java>>正文


Java Modifier类代码示例

本文整理汇总了Java中java.nio.file.WatchEvent.Modifier的典型用法代码示例。如果您正苦于以下问题:Java Modifier类的具体用法?Java Modifier怎么用?Java Modifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Modifier类属于java.nio.file.WatchEvent包,在下文中一共展示了Modifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWatchEventModifiers

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
/**
 * This is required to speed up mac based file watcher implementations
 *
 * @return sensitivity watch event modifier
 */
private static Modifier[] getWatchEventModifiers() {
  String className = "com.sun.nio.file.SensitivityWatchEventModifier";

  try {
    Class<?> c = Class.forName(className);
    Field f = c.getField("HIGH");
    Modifier modifier = cast(f.get(c));
    LOG.debug("Class '{}' is found in classpath setting corresponding watch modifier", className);

    return new Modifier[] {modifier};
  } catch (Exception e) {
    LOG.debug("Class '{}' is not found in classpath, falling to default mode", className, e);

    return new Modifier[] {};
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:FileWatcherService.java

示例2: registerTreeRecursive

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void registerTreeRecursive() throws Exception {
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class)
      .expect(newThread)
      .expect(registerTree(true, false))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
        unit.captured(FileVisitor.class).get(0).preVisitDirectory(unit.get(Path.class), null);
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:19,代码来源:FileMonitorTest.java

示例3: registerTree

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void registerTree() throws Exception {
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:17,代码来源:FileMonitorTest.java

示例4: registerTreeErr

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void registerTreeErr() throws Exception {
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class)
      .expect(newThread)
      .expect(registerTree(false, true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:17,代码来源:FileMonitorTest.java

示例5: pollIgnoreMissing

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollIgnoreMissing() throws Exception {
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(takeIgnore)
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:18,代码来源:FileMonitorTest.java

示例6: pollEvents

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEvents() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_MODIFY, path))
      .expect(filter(true))
      .expect(handler(StandardWatchEventKinds.ENTRY_MODIFY, false))
      .expect(recursive(false, false))
      .expect(reset(true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:FileMonitorTest.java

示例7: pollEventsInvalid

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEventsInvalid() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_MODIFY, path))
      .expect(filter(true))
      .expect(handler(StandardWatchEventKinds.ENTRY_MODIFY, false))
      .expect(recursive(false, false))
      .expect(reset(false))
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:24,代码来源:FileMonitorTest.java

示例8: pollEventsRecursive

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEventsRecursive() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_CREATE, path))
      .expect(filter(true))
      .expect(handler(StandardWatchEventKinds.ENTRY_CREATE, false))
      .expect(recursive(true, false))
      .expect(reset(true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.first(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:FileMonitorTest.java

示例9: pollEventsRecursiveErr

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEventsRecursiveErr() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_CREATE, path))
      .expect(filter(true))
      .expect(handler(StandardWatchEventKinds.ENTRY_CREATE, false))
      .expect(recursive(true, true))
      .expect(reset(true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.first(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:FileMonitorTest.java

示例10: pollEventWithHandleErr

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEventWithHandleErr() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_MODIFY, path))
      .expect(filter(true))
      .expect(handler(StandardWatchEventKinds.ENTRY_MODIFY, true))
      .expect(recursive(false, false))
      .expect(reset(true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:FileMonitorTest.java

示例11: pollEventsNoMatches

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Test
public void pollEventsNoMatches() throws Exception {
  Path path = Paths.get("target/foo.txt");
  new MockUnit(Injector.class, Env.class, WatchService.class, FileEventOptions.class, Path.class,
      WatchEvent.Kind.class, WatchEvent.Modifier.class, WatchKey.class, WatchEvent.class,
      PathMatcher.class, FileEventHandler.class)
      .expect(newThread)
      .expect(registerTree(false, false))
      .expect(take)
      .expect(poll(StandardWatchEventKinds.ENTRY_MODIFY, path))
      .expect(filter(false))
      .expect(recursive(false, false))
      .expect(reset(true))
      .expect(takeInterrupt)
      .run(unit -> {
        FileMonitor monitor = new FileMonitor(unit.get(Injector.class), unit.get(Env.class),
            unit.get(WatchService.class),
            ImmutableSet.of(unit.get(FileEventOptions.class)));
        unit.captured(ThreadFactory.class).get(0).newThread(monitor);
      }, unit -> {
        unit.captured(Runnable.class).get(0).run();
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:24,代码来源:FileMonitorTest.java

示例12: register

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException {
	if (!CloudWatchService.class.isAssignableFrom(watcher.getClass())) {
		throw new IllegalArgumentException("The file system watcher must be of type " +
				CloudWatchService.class + " but was " + watcher.getClass());
	}

	return ((CloudWatchService)watcher).register(this, events, modifiers);
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:10,代码来源:CloudPath.java

示例13: register

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
protected JWatchKey register(JPath path, Kind<?>[] events, Modifier ... modifiers)
{
  JWatchKey key = new JWatchKey(this, path, events, modifiers);

  synchronized (this) {
    _watchList.add(key);
  }

  return key;
}
 
开发者ID:baratine,项目名称:baratine,代码行数:11,代码来源:JWatchService.java

示例14: JWatchKey

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
public JWatchKey(JWatchService watchService,
                 JPath path,
                 Kind<?>[] events,
                 Modifier ... modifiers)
{
  Objects.requireNonNull(events);

  _watchService = watchService;
  _path = path;
  _events = events;
  _modifiers = modifiers;

  _watchHandle = path.getBfsFile().watch(pathString -> onWatch(pathString));
}
 
开发者ID:baratine,项目名称:baratine,代码行数:15,代码来源:JWatchKey.java

示例15: register

import java.nio.file.WatchEvent.Modifier; //导入依赖的package包/类
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
                         Modifier... modifiers) throws IOException
{
  if (events.length == 0) {
    throw new IllegalArgumentException(L.l("no events specified to watch on: {0}", toUri()));
  }

  JWatchService jWatcher = (JWatchService) watcher;

  WatchKey key = jWatcher.register(this, events, modifiers);

  return key;
}
 
开发者ID:baratine,项目名称:baratine,代码行数:15,代码来源:JPath.java


注:本文中的java.nio.file.WatchEvent.Modifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。