org.kie.commons.java.nio.file.Path.getFileSystem()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.kie.commons.java.nio.file.Path.getFileSystem()方法的一些代码示例,展示了Path.getFileSystem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getFileSystem()方法的具体详情如下:
包路径:org.kie.commons.java.nio.file.Path
类名称:Path
方法名:getFileSystem

Path.getFileSystem介绍

暂无

代码示例

代码示例来源:origin: org.kie.commons/kie-commons-io

protected boolean isFileScheme( final Path path ) {
  if ( path == null || path.getFileSystem() == null || path.getFileSystem().provider() == null ) {
    return false;
  }
  return path.getFileSystem().provider().getScheme().equals( "file" );
}

代码示例来源:origin: org.kie.guvnor/guvnor-explorer-backend

private String getRootDirectory( final org.kie.commons.java.nio.file.Path path ) {
  final Iterator<FileStore> fileStoreIterator = path.getFileSystem().getFileStores().iterator();
  if ( fileStoreIterator.hasNext() ) {
    return fileStoreIterator.next().name();
  }
  return "";
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path createDirectories( final Path dir,
                final Map<String, ?> attrs ) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( dir.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.createDirectories( dir, attrs );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path setAttributes( final Path path,
              final FileAttribute<?>... attrs ) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.setAttributes( path, attrs );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final String content,
          final Set<? extends OpenOption> options,
          final FileAttribute<?>... attrs ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, content, options, attrs );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final String content,
          final Map<String, ?> attrs,
          final OpenOption... options ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, content, attrs, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path setAttribute( final Path path,
             final String attribute,
             final Object value ) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.setAttribute( path, attribute, value );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final byte[] bytes,
          final OpenOption... options ) throws IOException, UnsupportedOperationException, SecurityException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, bytes, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final Iterable<? extends CharSequence> lines,
          final Charset cs,
          final OpenOption... options ) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, lines, cs, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final String content,
          final OpenOption... options ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, content, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path createDirectory( final Path dir,
               final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( dir.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.createDirectory( dir, attrs );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public long copy( final InputStream in,
         final Path target,
         final CopyOption... options ) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {
  return new FileSystemSyncLock<Long>( target.getFileSystem() ).execute( clusterService, new FutureTask<Long>( new Callable<Long>() {
    @Override
    public Long call() throws Exception {
      return service.copy( in, target, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final String content,
          final Charset cs,
          final Map<String, ?> attrs,
          final OpenOption... options ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, content, cs, attrs, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path createDirectories( final Path dir,
                final FileAttribute<?>... attrs ) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( dir.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.createDirectories( dir, attrs );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public boolean deleteIfExists( final Path path,
                final DeleteOption... options ) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {
  return new FileSystemSyncLock<Boolean>( path.getFileSystem() ).execute( clusterService, new FutureTask<Boolean>( new Callable<Boolean>() {
    @Override
    public Boolean call() throws Exception {
      return service.deleteIfExists( path, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path copy( final Path source,
         final Path target,
         final CopyOption... options ) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {
  return new FileSystemSyncLock<Path>( target.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.copy( source, target, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
  public Path call() throws Exception {
    return new FileSystemSyncLock<Path>( target.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
      @Override
      public Path call() throws Exception {
        return service.move( source, target, options );
      }
    } ) );
  }
} ) );

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path write( final Path path,
          final String content,
          final Charset cs,
          final OpenOption... options ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
  return new FileSystemSyncLock<Path>( path.getFileSystem() ).execute( clusterService, new FutureTask<Path>( new Callable<Path>() {
    @Override
    public Path call() throws Exception {
      return service.write( path, content, cs, options );
    }
  } ) );
}

代码示例来源:origin: org.kie.guvnor/guvnor-core-services-backend

@Override
  public Path restore( final Path _path,
             final String comment ) {
    final org.kie.commons.java.nio.file.Path path = paths.convert( _path );

    final org.kie.commons.java.nio.file.Path target = path.getFileSystem().getPath( path.toString() );

    return paths.convert( ioService.copy( path, target, REPLACE_EXISTING, new CommentedOption( identity.getName(), comment ) ) );
  }
}

代码示例来源:origin: org.kie.commons/kie-nio2-fs

@Test
public void validateGetPath() {
  final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
  final URI uri = URI.create( "file:///path/to/file.txt" );
  final Path path = fsProvider.getPath( uri );
  assertThat( path ).isNotNull();
  assertThat( path.isAbsolute() ).isTrue();
  assertThat( path.getFileSystem() ).isEqualTo( fsProvider.getFileSystem( uri ) );
  assertThat( path.getFileSystem().provider() ).isEqualTo( fsProvider );
  assertThat( path.toString() ).isEqualTo( "/path/to/file.txt" );
}

相关文章