类java.nio.file.attribute.FileAttributeView源码实例Demo

下面列出了怎么用java.nio.file.attribute.FileAttributeView的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: mycore   文件: MCRFileSystemProvider.java
@SuppressWarnings("unchecked")
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
    MCRPath mcrPath = MCRFileSystemUtils.checkPathAbsolute(path);
    if (type == null) {
        throw new NullPointerException();
    }
    //must support BasicFileAttributeView
    if (type == BasicFileAttributeView.class) {
        return (V) new BasicFileAttributeViewImpl(mcrPath);
    }
    if (type == MCRMD5AttributeView.class) {
        return (V) new MD5FileAttributeViewImpl(mcrPath);
    }
    return null;
}
 
源代码2 项目: mycore   文件: MCRFileSystemProvider.java
@SuppressWarnings("unchecked")
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
    MCRPath mcrPath = MCRFileSystemUtils.checkPathAbsolute(path);
    if (type == null) {
        throw new NullPointerException();
    }
    //must support BasicFileAttributeView
    if (type == BasicFileAttributeView.class) {
        return (V) new BasicFileAttributeViewImpl(mcrPath);
    }
    if (type == MCRMD5AttributeView.class) {
        return (V) new MD5FileAttributeViewImpl(mcrPath);
    }
    return null;
}
 
源代码3 项目: mycore   文件: MCRDirectoryStream.java
@SuppressWarnings("unchecked")
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
    if (path != null) {
        MCRPath file = checkRelativePath(path);
        if (file.getNameCount() != 1) {
            throw new InvalidPathException(path.toString(), "'path' must have one name component.");
        }
    }
    checkClosed();
    if (type == null) {
        throw new NullPointerException();
    }
    //must support BasicFileAttributeView
    if (type == BasicFileAttributeView.class) {
        return (V) new BasicFileAttributeViewImpl(this, path);
    }
    if (type == MCRMD5AttributeView.class) {
        return (V) new MD5FileAttributeViewImpl(this, path);
    }
    return null;
}
 
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path,
		Class<V> type, LinkOption... options) {
	BundleFileSystem fs = (BundleFileSystem) path.getFileSystem();
	if (path.toAbsolutePath().equals(fs.getRootDirectory())) {
		// Bug in ZipFS, it will fall over as there is no entry for /
		//
		// Instead we'll just give a view of the source (e.g. the zipfile
		// itself).
		// Modifying its times is a bit futile since they are likely to be
		// overriden when closing, but this avoids a NullPointerException
		// in Files.setTimes().
		return Files.getFileAttributeView(fs.getSource(), type, options);
	}
	return origProvider(path).getFileAttributeView(fs.unwrap(path), type,
			options);
}
 
源代码5 项目: dragonwell8_jdk   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码6 项目: TencentKona-8   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码7 项目: jdk8u60   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
@Test
public void getFileAttributeView() {
    final Path path = mock(Path.class);
    final Class<FileAttributeView> type = FileAttributeView.class;

    provider.getFileAttributeView(path, type);

    verify(delegate).getFileAttributeView(path, type);
}
 
源代码9 项目: openjdk-jdk8u   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码11 项目: jsr203-hadoop   文件: HadoopFileStore.java
@Override
public boolean supportsFileAttributeView(
    Class<? extends FileAttributeView> type) {
  if (type == BasicFileAttributeView.class) {
    return this.system.supportedFileAttributeViews().contains("basic");
  }
  if (type == PosixFileAttributeView.class) {
    return this.system.supportedFileAttributeViews().contains("posix");
  }
  // FIXME Implements all FileAttributeView checks
  return false;
}
 
源代码12 项目: openjdk-jdk9   文件: TestProvider.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    Path delegate = theFileSystem.unwrap(file);
    return defaultProvider.getFileAttributeView(delegate, type, options);
}
 
源代码13 项目: openjdk-jdk9   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码14 项目: openjdk-8-source   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码15 项目: mycore   文件: MCRDirectoryStream.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Class<V> type) {
    V fileAttributeView = baseStream.getFileAttributeView(type);
    if (fileAttributeView != null) {
        return fileAttributeView;
    }
    if (type == MCRMD5AttributeView.class) {
        BasicFileAttributeView baseView = baseStream.getFileAttributeView(BasicFileAttributeView.class);
        return (V) new MD5FileAttributeViewImpl(baseView, (v) -> dir);
    }
    return null;
}
 
源代码16 项目: mycore   文件: MCRDirectoryStream.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
    Path localRelativePath = toLocalPath(path);
    if (type == MCRMD5AttributeView.class) {
        BasicFileAttributeView baseView = baseStream.getFileAttributeView(localRelativePath,
            BasicFileAttributeView.class, options);
        return (V) new MD5FileAttributeViewImpl(baseView, (v) -> resolve(path));
    }
    return baseStream.getFileAttributeView(localRelativePath, type, options);
}
 
源代码17 项目: ParallelGit   文件: FilesGetAttributeViewTest.java
@Test
public void getFileAttributeViewFromFile_shouldBeNotNull() throws IOException {
  initRepository();
  writeToCache("/file.txt");
  commitToMaster();
  initGitFileSystem();
  assertNotNull(Files.getFileAttributeView(gfs.getPath("/file.txt"), FileAttributeView.class));
}
 
源代码18 项目: baratine   文件: FileProviderBase.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path,
                                                            Class<V> type,
                                                            LinkOption... options)
{
  throw new UnsupportedOperationException();
}
 
源代码19 项目: baratine   文件: JFileSystemProvider.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path,
                                                            Class<V> type,
                                                            LinkOption... options)
{
  // TODO Auto-generated method stub
  throw new UnsupportedOperationException();
}
 
源代码20 项目: sftp-fs   文件: SFTPFileSystemProvider.java
/**
 * Returns a file attribute view of a given type.
 * This method works in exactly the manner specified by the {@link Files#getFileAttributeView(Path, Class, LinkOption...)} method.
 * <p>
 * This provider supports {@link BasicFileAttributeView}, {@link FileOwnerAttributeView} and {@link PosixFileAttributeView}.
 * All other classes will result in a {@code null} return value.
 * <p>
 * Note: if the type is {@link BasicFileAttributeView} or a sub type, the last access time and creation time must be {@code null} when calling
 * {@link BasicFileAttributeView#setTimes(FileTime, FileTime, FileTime)}, otherwise an exception will be thrown.
 * When setting the owner or group for the path, the name must be the UID/GID of the owner/group.
 */
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
    Objects.requireNonNull(type);
    if (type == BasicFileAttributeView.class) {
        return type.cast(new AttributeView("basic", toSFTPPath(path))); //$NON-NLS-1$
    }
    if (type == FileOwnerAttributeView.class) {
        return type.cast(new AttributeView("owner", toSFTPPath(path))); //$NON-NLS-1$
    }
    if (type == PosixFileAttributeView.class) {
        return type.cast(new AttributeView("posix", toSFTPPath(path))); //$NON-NLS-1$
    }
    return null;
}
 
源代码21 项目: openjdk-8   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码22 项目: jdk8u_jdk   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码23 项目: ParallelGit   文件: GfsFileStore.java
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
  return
    type.isAssignableFrom(GfsFileAttributeView.Basic.class)
      || type.isAssignableFrom(GfsFileAttributeView.Posix.class)
      || type.isAssignableFrom(GfsFileAttributeView.Git.class);
}
 
源代码24 项目: jsr203-hadoop   文件: HadoopFileSystem.java
@SuppressWarnings("unchecked")
<V extends FileAttributeView> V getView(HadoopPath path, Class<V> type) {
       if (type == null)
           throw new NullPointerException();
       if (type == BasicFileAttributeView.class)
           return (V)new HadoopBasicFileAttributeView(path, false);
       if (type == HadoopBasicFileAttributeView.class)
           return (V)new HadoopBasicFileAttributeView(path, true);
       if (type == FileOwnerAttributeView.class)
           return (V)new HadoopPosixFileAttributeView(path, false);
       if (type == PosixFileAttributeView.class)
           return (V)new HadoopPosixFileAttributeView(path, true);
       return null;
   }
 
源代码25 项目: jdk8u-jdk   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码26 项目: jdk8u-dev-jdk   文件: FaultyFileSystem.java
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
源代码27 项目: ParallelGit   文件: GfsFileStore.java
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
  return
    type.isAssignableFrom(GfsFileAttributeView.Basic.class)
      || type.isAssignableFrom(GfsFileAttributeView.Posix.class)
      || type.isAssignableFrom(GfsFileAttributeView.Git.class);
}
 
源代码28 项目: dragonwell8_jdk   文件: ZipFileStore.java
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
    return (type == BasicFileAttributeView.class ||
            type == ZipFileAttributeView.class);
}
 
源代码29 项目: TencentKona-8   文件: ZipFileStore.java
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
    return (type == BasicFileAttributeView.class ||
            type == ZipFileAttributeView.class);
}
 
源代码30 项目: jdk8u60   文件: ZipFileStore.java
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
    return (type == BasicFileAttributeView.class ||
            type == ZipFileAttributeView.class);
}
 
 类所在包
 同包方法