java.nio.file.attribute.PosixFileAttributes Java Examples
The following examples show how to use
java.nio.file.attribute.PosixFileAttributes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalAttributesFinderFeatureTest.java From cyberduck with GNU General Public License v3.0 | 8 votes |
@Test public void testConvert() throws Exception { final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname())); if(session.isPosixFilesystem()) { session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); final Path file = new Path(new LocalHomeFinderFeature(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new LocalTouchFeature(session).touch(file, new TransferStatus()); final java.nio.file.Path local = session.toPath(file); final PosixFileAttributes posixAttributes = Files.readAttributes(local, PosixFileAttributes.class); final LocalAttributesFinderFeature finder = new LocalAttributesFinderFeature(session); assertEquals(PosixFilePermissions.toString(posixAttributes.permissions()), finder.find(file).getPermission().getSymbol()); Files.setPosixFilePermissions(local, PosixFilePermissions.fromString("rw-------")); assertEquals("rw-------", finder.find(file).getPermission().getSymbol()); Files.setPosixFilePermissions(local, PosixFilePermissions.fromString("rwxrwxrwx")); assertEquals("rwxrwxrwx", finder.find(file).getPermission().getSymbol()); Files.setPosixFilePermissions(local, PosixFilePermissions.fromString("rw-rw----")); assertEquals("rw-rw----", finder.find(file).getPermission().getSymbol()); assertEquals(posixAttributes.size(), finder.find(file).getSize()); assertEquals(posixAttributes.lastModifiedTime().toMillis(), finder.find(file).getModificationDate()); assertEquals(posixAttributes.creationTime().toMillis(), finder.find(file).getCreationDate()); assertEquals(posixAttributes.lastAccessTime().toMillis(), finder.find(file).getAccessedDate()); new LocalDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); } }
Example #2
Source File: LocalIgfsSecondaryFileSystem.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public IgfsFile info(final IgfsPath path) { File file = fileForPath(path); if (!file.exists()) return null; boolean isDir = file.isDirectory(); PosixFileAttributes attrs = LocalFileSystemUtils.posixAttributes(file); Map<String, String> props = LocalFileSystemUtils.posixAttributesToMap(attrs); BasicFileAttributes basicAttrs = LocalFileSystemUtils.basicAttributes(file); if (isDir) { return new LocalFileSystemIgfsFile(path, false, true, 0, basicAttrs.lastAccessTime().toMillis(), basicAttrs.lastModifiedTime().toMillis(), 0, props); } else { return new LocalFileSystemIgfsFile(path, file.isFile(), false, 0, basicAttrs.lastAccessTime().toMillis(), basicAttrs.lastModifiedTime().toMillis(), file.length(), props); } }
Example #3
Source File: HadoopFileSystemProvider.java From jsr203-hadoop with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException { if (type == BasicFileAttributes.class || type == HadoopBasicFileAttributes.class) { return (A) toHadoopPath(path).getAttributes(); } if (type == PosixFileAttributes.class) { return (A) toHadoopPath(path).getPosixAttributes(); } throw new UnsupportedOperationException("readAttributes:" + type.getName()); }
Example #4
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesSymLinkToDirectoryNoFollowLinks() throws IOException { Path foo = addDirectory("/foo"); Path bar = addSymLink("/bar", foo); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/bar"), LinkOption.NOFOLLOW_LINKS); long sizeOfBar = Files.readAttributes(bar, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); // on Windows, foo and bar have the same sizes assertEquals(sizeOfBar, attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertFalse(attributes.isDirectory()); assertFalse(attributes.isRegularFile()); assertTrue(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #5
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesSymLinkToDirectoryFollowLinks() throws IOException { Path foo = addDirectory("/foo"); addSymLink("/bar", foo); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/bar")); long sizeOfFoo = Files.readAttributes(foo, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); // on Windows, foo and bar have the same sizes assertEquals(sizeOfFoo, attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertTrue(attributes.isDirectory()); assertFalse(attributes.isRegularFile()); assertFalse(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #6
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesSymLinkToFileNoFollowLinks() throws IOException { Path foo = addFile("/foo"); setContents(foo, new byte[1024]); Path bar = addSymLink("/bar", foo); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/bar"), LinkOption.NOFOLLOW_LINKS); long sizeOfFoo = Files.readAttributes(foo, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); long sizeOfBar = Files.readAttributes(bar, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); assertEquals(sizeOfBar, attributes.size()); assertNotEquals(sizeOfFoo, attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertFalse(attributes.isDirectory()); assertFalse(attributes.isRegularFile()); assertTrue(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #7
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesSymLinkToFileFollowLinks() throws IOException { Path foo = addFile("/foo"); setContents(foo, new byte[1024]); Path bar = addSymLink("/bar", foo); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/bar")); long sizeOfFoo = Files.readAttributes(foo, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); long sizeOfBar = Files.readAttributes(bar, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).size(); assertEquals(sizeOfFoo, attributes.size()); assertNotEquals(sizeOfBar, attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertFalse(attributes.isDirectory()); assertTrue(attributes.isRegularFile()); assertFalse(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #8
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesFileNoFollowLinks() throws IOException { Path foo = addFile("/foo"); setContents(foo, new byte[1024]); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/foo"), LinkOption.NOFOLLOW_LINKS); assertEquals(Files.size(foo), attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertFalse(attributes.isDirectory()); assertTrue(attributes.isRegularFile()); assertFalse(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #9
Source File: LocalFileSystemUtils.java From ignite with Apache License 2.0 | 6 votes |
/** * Get POSIX attributes for file. * * @param file File. * @return PosixFileAttributes. */ @Nullable public static PosixFileAttributes posixAttributes(File file) { PosixFileAttributes attrs = null; try { PosixFileAttributeView view = Files.getFileAttributeView(file.toPath(), PosixFileAttributeView.class); if (view != null) attrs = view.readAttributes(); } catch (IOException e) { throw new IgfsException("Failed to read POSIX attributes: " + file.getAbsolutePath(), e); } return attrs; }
Example #10
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 6 votes |
@Test public void testReadAttributesFileFollowLinks() throws IOException { Path foo = addFile("/foo"); setContents(foo, new byte[1024]); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/foo")); assertEquals(Files.size(foo), attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertFalse(attributes.isDirectory()); assertTrue(attributes.isRegularFile()); assertFalse(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #11
Source File: UnixSshFileSystemProvider.java From jsch-nio with MIT License | 6 votes |
Map<UnixSshPath, PosixFileAttributes> statDirectory( UnixSshPath directoryPath ) throws IOException { Map<UnixSshPath, PosixFileAttributes> map = new HashMap<>(); SupportedAttribute[] allAttributes = SupportedAttribute.values(); String command = directoryPath.getFileSystem().getCommand( "find" ) + " " + directoryPath.toAbsolutePath().quotedString() + " -maxdepth 1 -type f -exec " + statCommand( directoryPath, allAttributes, true ) + " {} +"; String stdout = executeForStdout( directoryPath, command ); if ( stdout.length() > 0 ) { String[] results = stdout.split( "\n" ); for ( String file : results ) { logger.trace( "parsing stat response for {}", file ); Map<String, Object> fileAttributes = statParse( file, allAttributes ); UnixSshPath filePath = directoryPath.toAbsolutePath().relativize( directoryPath.resolve( (String)fileAttributes.get( SupportedAttribute.name.toString() ) ) ); map.put( filePath, new PosixFileAttributesImpl( fileAttributes ) ); } } logger.trace( "returning map" ); return map; }
Example #12
Source File: PosixFileAttributeManager.java From yajsync with GNU General Public License v3.0 | 6 votes |
@Override public RsyncFileAttributes stat(Path path) throws IOException { PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS); UserPrincipal userPrincipal = attrs.owner(); String userName = userPrincipal.getName(); GroupPrincipal groupPrincipal = attrs.group(); String groupName = groupPrincipal.getName(); _nameToUserPrincipal.putIfAbsent(userName, userPrincipal); _nameToGroupPrincipal.putIfAbsent(groupName, groupPrincipal); return new RsyncFileAttributes(toMode(attrs), attrs.size(), attrs.lastModifiedTime().to(TimeUnit.SECONDS), new User(userName, _defaultUserId), new Group(groupName, _defaultGroupId)); }
Example #13
Source File: CompressedDirectory.java From docker-client with Apache License 2.0 | 6 votes |
private static int getPosixFileMode(Path file) throws IOException { final PosixFileAttributes attr = Files.readAttributes(file, PosixFileAttributes.class); final Set<PosixFilePermission> perm = attr.permissions(); // retain permissions, note these values are octal //noinspection OctalInteger int mode = 0100000; //noinspection OctalInteger mode += 0100 * getModeFromPermissions( perm.contains(PosixFilePermission.OWNER_READ), perm.contains(PosixFilePermission.OWNER_WRITE), perm.contains(PosixFilePermission.OWNER_EXECUTE)); //noinspection OctalInteger mode += 010 * getModeFromPermissions( perm.contains(PosixFilePermission.GROUP_READ), perm.contains(PosixFilePermission.GROUP_WRITE), perm.contains(PosixFilePermission.GROUP_EXECUTE)); mode += getModeFromPermissions( perm.contains(PosixFilePermission.OTHERS_READ), perm.contains(PosixFilePermission.OTHERS_WRITE), perm.contains(PosixFilePermission.OTHERS_EXECUTE)); return mode; }
Example #14
Source File: KnoxShellTableTest.java From knox with Apache License 2.0 | 6 votes |
@Test public void testToAndFromJSON() throws IOException { KnoxShellTable table = new KnoxShellTable(); table.header("Column A").header("Column B").header("Column C"); table.row().value("123").value("456").value("344444444"); table.row().value("789").value("012").value("844444444"); String json = table.toJSON(); KnoxShellTable table2 = KnoxShellTable.builder().json().fromJson(json); assertEquals(table.toString(), table2.toString()); final Path jsonPath = Paths.get(testFolder.newFolder().getAbsolutePath(), "testJson.json"); table.toJSON(jsonPath.toString()); final PosixFileAttributes jsonPathAttributes = Files.readAttributes(jsonPath, PosixFileAttributes.class); assertEquals("rw-------", PosixFilePermissions.toString(jsonPathAttributes.permissions())); KnoxShellTable table3 = KnoxShellTable.builder().json().path(jsonPath.toString()); assertEquals(table.toString(), table3.toString()); }
Example #15
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getGroupOfFile_shouldReturnNull() throws IOException { writeToCache("/file.txt"); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); assertNull(attributes.group()); }
Example #16
Source File: PosixAttributeProviderTest.java From jimfs with Apache License 2.0 | 5 votes |
@Test public void testView() throws IOException { file.setAttribute("owner", "owner", createUserPrincipal("user")); PosixFileAttributeView view = provider.view( fileLookup(), ImmutableMap.of( "basic", new BasicAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS), "owner", new OwnerAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS))); assertNotNull(view); assertThat(view.name()).isEqualTo("posix"); assertThat(view.getOwner()).isEqualTo(createUserPrincipal("user")); PosixFileAttributes attrs = view.readAttributes(); assertThat(attrs.fileKey()).isEqualTo(0); assertThat(attrs.owner()).isEqualTo(createUserPrincipal("user")); assertThat(attrs.group()).isEqualTo(createGroupPrincipal("group")); assertThat(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--")); view.setOwner(createUserPrincipal("root")); assertThat(view.getOwner()).isEqualTo(createUserPrincipal("root")); assertThat(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root")); view.setGroup(createGroupPrincipal("root")); assertThat(view.readAttributes().group()).isEqualTo(createGroupPrincipal("root")); assertThat(file.getAttribute("posix", "group")).isEqualTo(createGroupPrincipal("root")); view.setPermissions(PosixFilePermissions.fromString("rwx------")); assertThat(view.readAttributes().permissions()) .isEqualTo(PosixFilePermissions.fromString("rwx------")); assertThat(file.getAttribute("posix", "permissions")) .isEqualTo(PosixFilePermissions.fromString("rwx------")); }
Example #17
Source File: IgfsLocalSecondaryFileSystemTestAdapter.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public Map<String, String> properties(final String path) throws IOException { Path p = path(path); PosixFileAttributes attrs = Files.getFileAttributeView(p, PosixFileAttributeView.class).readAttributes(); Map<String, String> props = new HashMap<>(); props.put(IgfsUtils.PROP_USER_NAME, attrs.owner().getName()); props.put(IgfsUtils.PROP_GROUP_NAME, attrs.group().getName()); props.put(IgfsUtils.PROP_PERMISSION, permissions(path)); return props; }
Example #18
Source File: PosixJdk7FilePermissionHandler.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public int getUnixMode(File file) { try { final PosixFileAttributes posixFileAttributes = Files.readAttributes(file.toPath(), PosixFileAttributes.class); return convertToInt(posixFileAttributes.permissions()); }catch (Exception e) { throw new NativeIntegrationException(String.format("Failed to read File permissions for %s", file.getAbsolutePath()), e); } }
Example #19
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getOwnerOfFile_shouldReturnNull() throws IOException { writeToCache("/file.txt"); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); assertNull(attributes.owner()); }
Example #20
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getPermissionOfExecutableFile_shouldContainOwnerExecute() throws IOException { writeToCache("/file.txt", someBytes(), EXECUTABLE_FILE); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); Collection permissions = (Collection) attributes.permissions(); assertTrue(permissions.contains(OWNER_EXECUTE)); }
Example #21
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getPermissionOfFile_shouldContainOwnerRead() throws IOException { writeToCache("/file.txt"); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); Collection permissions = (Collection) attributes.permissions(); assertTrue(permissions.contains(PosixFilePermission.OWNER_READ)); }
Example #22
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getPermissionOfFile_shouldContainOwnerWrite() throws IOException { writeToCache("/file.txt"); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); Collection permissions = (Collection) attributes.permissions(); assertTrue(permissions.contains(PosixFilePermission.OWNER_WRITE)); }
Example #23
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getPermissionOfFile_shouldReturnNotNull() throws IOException { writeToCache("/file.txt"); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); assertNotNull(attributes.permissions()); }
Example #24
Source File: PosixFileAttributesTest.java From ParallelGit with Apache License 2.0 | 5 votes |
@Test public void getPermissionOfExecutableFile_shouldContainOwnerExecute() throws IOException { writeToCache("/file.txt", someBytes(), EXECUTABLE_FILE); commitToMaster(); initGitFileSystem(); PosixFileAttributes attributes = readPosixAttributes("/file.txt"); Collection permissions = (Collection) attributes.permissions(); assertTrue(permissions.contains(OWNER_EXECUTE)); }
Example #25
Source File: Dir.java From mdw with Apache License 2.0 | 5 votes |
private void addDetails() throws IOException { Path path = Paths.get(this.path); this.absolutePath = path.toAbsolutePath().toString().replace('\\', '/'); if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { PosixFileAttributes attrs = Files.getFileAttributeView(path, PosixFileAttributeView.class).readAttributes(); permissions = PosixFilePermissions.toString(attrs.permissions()); UserPrincipal ownerPrincipal = attrs.owner(); owner = ownerPrincipal.toString(); UserPrincipal groupPrincipal = attrs.group(); group = groupPrincipal.toString(); size = path.toFile().length(); numLinks = path.toFile().list().length + 2; } }
Example #26
Source File: Utils.java From ChromeForensics with Apache License 2.0 | 5 votes |
/** * * @param fileLoc * @return */ public static Map<String, String> getFileMetadata(Path fileLoc) { Map<String, String> linkedHashMap = new LinkedHashMap<>(); try { DosFileAttributes dosFileAttr = Files.readAttributes(fileLoc, DosFileAttributes.class); linkedHashMap.put("File Name", fileLoc.getFileName().toString()); linkedHashMap.put("File Location", fileLoc.toString()); linkedHashMap.put("File Size", readableFileSize(dosFileAttr.size())); linkedHashMap.put("Creation Time", getDateTime(dosFileAttr.creationTime())); linkedHashMap.put("Last Accessed Time", getDateTime(dosFileAttr.lastAccessTime())); linkedHashMap.put("Last Modified Time", getDateTime(dosFileAttr.lastModifiedTime())); linkedHashMap.put("Is Directory?", dosFileAttr.isDirectory() ? "True" : "False"); linkedHashMap.put("Is Regular File?", dosFileAttr.isRegularFile() ? "True" : "False"); linkedHashMap.put("Is Symbolic Link?", dosFileAttr.isSymbolicLink() ? "True" : "False"); linkedHashMap.put("Is Archive?", dosFileAttr.isArchive() ? "True" : "False"); linkedHashMap.put("Is Hidden File?", dosFileAttr.isHidden() ? "True" : "False"); linkedHashMap.put("Is ReadOnly?", dosFileAttr.isReadOnly() ? "True" : "False"); linkedHashMap.put("Is System File?", dosFileAttr.isSystem() ? "True" : "False"); if (getOsName().equals("Linux")) { PosixFileAttributes attr = Files.readAttributes(fileLoc, PosixFileAttributes.class); String posixPerm = String.format("%s %s %s%n", attr.owner().getName(), attr.group().getName(), PosixFilePermissions.toString(attr.permissions())); linkedHashMap.put("Posix", posixPerm); } } catch (UnsupportedOperationException | IOException ex) { System.err.println(ex.getMessage()); } return linkedHashMap; }
Example #27
Source File: SFTPFileSystemTest.java From sftp-fs with Apache License 2.0 | 5 votes |
@Test public void testReadAttributesDirectoryNoFollowLinks() throws IOException { Path foo = addDirectory("/foo"); PosixFileAttributes attributes = fileSystem.readAttributes(createPath("/foo"), LinkOption.NOFOLLOW_LINKS); assertEquals(Files.size(foo), attributes.size()); assertNotNull(attributes.owner().getName()); assertNotNull(attributes.group().getName()); assertNotNull(attributes.permissions()); assertTrue(attributes.isDirectory()); assertFalse(attributes.isRegularFile()); assertFalse(attributes.isSymbolicLink()); assertFalse(attributes.isOther()); }
Example #28
Source File: HadoopPosixFileAttributeView.java From jsr203-hadoop with Apache License 2.0 | 5 votes |
@Override public PosixFileAttributes readAttributes() throws IOException { Path resolvedPath = path.getRawResolvedPath(); FileStatus fileStatus = path.getFileSystem().getHDFS() .getFileStatus(resolvedPath); String fileKey = resolvedPath.toString(); return new HadoopPosixFileAttributes(this.path.getFileSystem(), fileKey, fileStatus); }
Example #29
Source File: TestFiles.java From jsr203-hadoop with Apache License 2.0 | 5 votes |
@Test public void getFileAttributeViewPosixFileAttributeView() throws IOException { Path rootPath = Paths.get(clusterUri); Path path = Files.createTempFile(rootPath, "test", "tmp"); PosixFileAttributeView view = Files.getFileAttributeView(path, PosixFileAttributeView.class); Assert.assertNotNull(view); Assert.assertEquals("posix", view.name()); PosixFileAttributes attributes; attributes = view.readAttributes(); Assert.assertNotNull(attributes.group()); Assert.assertNotNull(attributes.group().getName()); Assert.assertNotNull(attributes.fileKey()); }
Example #30
Source File: SFTPFileSystem.java From sftp-fs with Apache License 2.0 | 5 votes |
PosixFileAttributes readAttributes(SFTPPath path, LinkOption... options) throws IOException { boolean followLinks = LinkOptionSupport.followLinks(options); try (Channel channel = channelPool.get()) { SftpATTRS attributes = getAttributes(channel, path, followLinks); return new SFTPPathFileAttributes(attributes); } }