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


Java Ref类代码示例

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


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

示例1: findFile

import de.pfabulist.kleinod.collection.Ref; //导入依赖的package包/类
public Optional<Path> findFile( Path base ) {
    final Ref<Optional<Path>> ret = Ref.valueOf( Optional.empty() );
    try {
        Files.walkFileTree(base, new SimpleFileVisitor<Path>() {

            @Override
            public FileVisitResult visitFile( Path file,
                                              BasicFileAttributes attrs) throws IOException {
                if ( !attrs.isDirectory() ) {

                    ret.set( Optional.of( file ));
                    return FileVisitResult.TERMINATE;
                }

                return FileVisitResult.CONTINUE;
            }

        });
    } catch (IOException e) {
        throw u( e );
    }

    return ret.get();
}
 
开发者ID:openCage,项目名称:stellvertreter,代码行数:25,代码来源:ClearConnectorTest.java

示例2: testWatchServiceTakeBlocks

import de.pfabulist.kleinod.collection.Ref; //导入依赖的package包/类
@Test
@Category( { SlowTest.class, Watchable.class, Writable.class } )
@SuppressWarnings( "PMD.EmptyCatchBlock" )
public void testWatchServiceTakeBlocks() throws Exception {
    Path dir = dirTA();
    final WatchService watcher = dir.getFileSystem().newWatchService();
    dir.register( watcher, ENTRY_CREATE );

    final Ref<Boolean> interrupted = Ref.valueOf( false );

    new Thread( () -> {
        try {
            watcher.take();
        } catch( InterruptedException | ClosedWatchServiceException e ) {
            // nothing to do
        } finally {
            interrupted.set( true );

        }
    } ).start();

    Thread.sleep( 1000 );

    assertThat( interrupted.get() ).isFalse();

}
 
开发者ID:openCage,项目名称:niotest,代码行数:27,代码来源:Tests11Watcher.java

示例3: testOnClose

import de.pfabulist.kleinod.collection.Ref; //导入依赖的package包/类
@Test
public void testOnClose() throws IOException {
    Ref<String> external = Ref.valueOf( "open" );

    Path hostcl3 = Pathss.getTmpDir( "cl3test" );
    Files.createDirectories( hostcl3 );
    FileSystem fscl = CloseableProvider.getUrim().getOrCreateFS(
            hostcl3,
            Collections.singletonMap( "external", external ) );

    fscl.close();

    assertThat( external.get()).isEqualTo( "closed" );
}
 
开发者ID:openCage,项目名称:eightyfs,代码行数:15,代码来源:CloseableTest.java

示例4: CloseableFS

import de.pfabulist.kleinod.collection.Ref; //导入依赖的package包/类
public CloseableFS( Path hostRoot, Ref<String> external ) {
    super( hostRoot );
    this.external = external;
}
 
开发者ID:openCage,项目名称:eightyfs,代码行数:5,代码来源:CloseableFS.java

示例5: create

import de.pfabulist.kleinod.collection.Ref; //导入依赖的package包/类
public static EightyFS create( Object hostRoot, RWAttributesBuilder ab, Map<String, Object> env ) {
    ab.addPosix().addOwner();
    return new CloseableFS( (Path) hostRoot, (Ref<String>) env.get("external") );
}
 
开发者ID:openCage,项目名称:eightyfs,代码行数:5,代码来源:CloseableFS.java


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