當前位置: 首頁>>代碼示例>>Java>>正文


Java FileAttributeView類代碼示例

本文整理匯總了Java中java.nio.file.attribute.FileAttributeView的典型用法代碼示例。如果您正苦於以下問題:Java FileAttributeView類的具體用法?Java FileAttributeView怎麽用?Java FileAttributeView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FileAttributeView類屬於java.nio.file.attribute包,在下文中一共展示了FileAttributeView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@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;
}
 
開發者ID:MyCoRe-Org,項目名稱:mycore,代碼行數:17,代碼來源:MCRFileSystemProvider.java

示例2: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@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;
}
 
開發者ID:MyCoRe-Org,項目名稱:mycore,代碼行數:23,代碼來源:MCRDirectoryStream.java

示例3: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@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);
}
 
開發者ID:apache,項目名稱:incubator-taverna-language,代碼行數:18,代碼來源:BundleFileSystemProvider.java

示例4: getSupportedFileAttributes

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
private Set<String> getSupportedFileAttributes(FileStore fs) {
  Set<String> attrs = new HashSet<String>();
  if (fs.supportsFileAttributeView(AclFileAttributeView.class)) {
    attrs.add("acl");
  }
  if (fs.supportsFileAttributeView(BasicFileAttributeView.class)) {
    attrs.add("basic");
  }
  if (fs.supportsFileAttributeView(FileOwnerAttributeView.class)) {
    attrs.add("owner");
  }
  if (fs.supportsFileAttributeView(UserDefinedFileAttributeView.class)) {
    attrs.add("user");
  }
  if (fs.supportsFileAttributeView(DosFileAttributeView.class)) {
    attrs.add("dos");
  }
  if (fs.supportsFileAttributeView(PosixFileAttributeView.class)) {
    attrs.add("posix");
  }
  if (fs.supportsFileAttributeView(FileAttributeView.class)) {
    attrs.add("file");
  }
  return attrs;
}
 
開發者ID:tinyMediaManager,項目名稱:tinyMediaManager,代碼行數:26,代碼來源:FSTest.java

示例5: supportsFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
public boolean supportsFileAttributeView(
        Class<? extends FileAttributeView> type) {
    
    String name = "notFound";
    if(type == BasicFileAttributeView.class) {
        name = "basic";
    } else if(type == DosFileAttributeView.class) {
        name = "dos";
    } else if(type == PosixFileAttributeView.class) {
        name = "posix";
    } else if(type == FileOwnerAttributeView.class) {
        name = "owner";
    }
    
    return  attributeSets.containsKey(name);
}
 
開發者ID:sbridges,項目名稱:ephemeralfs,代碼行數:17,代碼來源:AttributeLookup.java

示例6: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path,
        Class<V> type, LinkOption... options) {
    final EphemeralFsPath efsPath = cast(path);
    synchronized(efsPath.fs.fsLock) {
        return efsPath.fs.getFileAttributeView(
                new EphemeralFsPathProvider() {
                    @Override
                    public EphemeralFsPath get() {
                        return translate(efsPath);
                    }
                }, 
                type, 
                closeChecker, 
                options);
    }
}
 
開發者ID:sbridges,項目名稱:ephemeralfs,代碼行數:18,代碼來源:EphemeralFsSecureDirectoryStream.java

示例7: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
public <V extends FileAttributeView> Optional<V> getFileAttributeView( EightyPath path, final Class<V> type, LinkOption... options ) {
    if( !isViewSupported( type ) ) {
        return Optional.empty();
    }

    if( !existsEx( path, options ) ) {
        return Optional.of( getFileAttributeViewDummy( path, type ) );
    }

    EightyPath real = toRealPathEx( path, options );

    EightyFileSystem eightyFileSystem = path._getFileSystem();
    EightyFS efs = eightyFileSystem.get80();

    V fav = getSymLinkSensitiveFileAttributeView( type, real, efs );

    handleReadOnlyFileSystems( eightyFileSystem, fav );

    return Optional.of( fav );
}
 
開發者ID:openCage,項目名稱:eightyfs,代碼行數:21,代碼來源:AttributeProvider.java

示例8: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
public <V extends FileAttributeView> V getFileAttributeView(
    Path path, Class<V> type, LinkOption... options) {
  checkOpen();
  final JimfsPath checkedPath = checkPath(path);
  final ImmutableSet<LinkOption> optionsSet = Options.getLinkOptions(options);
  return view.getFileAttributeView(
      new FileLookup() {
        @Override
        public File lookup() throws IOException {
          checkOpen(); // per the spec, must check that the stream is open for each view operation
          return view
              .lookUpWithLock(checkedPath, optionsSet)
              .requireExists(checkedPath)
              .file();
        }
      },
      type);
}
 
開發者ID:google,項目名稱:jimfs,代碼行數:20,代碼來源:JimfsSecureDirectoryStream.java

示例9: testView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Test
public void testView() throws IOException {
  AclFileAttributeView view =
      provider.view(
          fileLookup(),
          ImmutableMap.<String, FileAttributeView>of(
              "owner", new OwnerAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS)));
  assertNotNull(view);

  assertThat(view.name()).isEqualTo("acl");

  assertThat(view.getAcl()).isEqualTo(defaultAcl);

  view.setAcl(ImmutableList.<AclEntry>of());
  view.setOwner(FOO);

  assertThat(view.getAcl()).isEqualTo(ImmutableList.<AclEntry>of());
  assertThat(view.getOwner()).isEqualTo(FOO);

  assertThat(file.getAttribute("acl", "acl")).isEqualTo(ImmutableList.<AclEntry>of());
}
 
開發者ID:google,項目名稱:jimfs,代碼行數:22,代碼來源:AclAttributeProviderTest.java

示例10: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
@Nullable
public <V extends FileAttributeView> V getFileAttributeView(
        Path path,
        Class<V> type,
        LinkOption... options) {
    return promote(path).getFileAttributeView(type, options);
}
 
開發者ID:christian-schlichtherle,項目名稱:truevfs,代碼行數:9,代碼來源:TFileSystemProvider.java

示例11: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path file,
                                                            Class<V> type,
                                                            LinkOption... options)
{
    return Files.getFileAttributeView(unwrap(file), type, options);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:FaultyFileSystem.java

示例12: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:TestProvider.java

示例13: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
/**
 * Can return a {@link CloudFileAttributesView}
 * @param type {@link CloudFileAttributesView} or {@link BasicFileAttributeView}
 */
@Override
public <V extends FileAttributeView> V getFileAttributeView(BlobStoreContext blobStoreContext, Class<V> type, CloudPath cloudPath) {
	if (CloudFileAttributesView.class.equals(type) || BasicFileAttributeView.class.equals(type)) {
		return type.cast(new CloudFileAttributesView(blobStoreContext, cloudPath));
	}

	return null;
}
 
開發者ID:brdara,項目名稱:java-cloud-filesystem-provider,代碼行數:13,代碼來源:DefaultCloudFileSystemImplementation.java

示例14: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
@SuppressWarnings( "unchecked" )
public <V extends FileAttributeView> V getFileAttributeView( Path path, Class<V> type, LinkOption... options )
{
    if( type.isAssignableFrom( BasicFileAttributeView.class ) )
    {
        P p = toCachePath( path );
        return (V) p.getFileSystem().getFileSystemIO().getAttributeView( p.getResolvedPath() );
    }
    throw new UnsupportedOperationException();
}
 
開發者ID:peter-mount,項目名稱:filesystem,代碼行數:12,代碼來源:AbstractLocalFileSystemProvider.java

示例15: getFileAttributeView

import java.nio.file.attribute.FileAttributeView; //導入依賴的package包/類
@Override
public <V extends FileAttributeView> V getFileAttributeView(Path path,
                                                            Class<V> type,
                                                            LinkOption... options)
{
  throw new UnsupportedOperationException();
}
 
開發者ID:baratine,項目名稱:baratine,代碼行數:8,代碼來源:FileProviderBase.java


注:本文中的java.nio.file.attribute.FileAttributeView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。