获取POSIX视图属性---POSIX
2013-12-30 17:14
453 查看
Files.readAttributes()
Files.getFileAttributeView().readAttributes()
POSIX的属性可以被要求以下列名称
notes:在Unix或linux上运行
Path path = Paths.get("/home/icer/note.txt"); PosixFileAttributes attr = null; try { attr = Files.readAttributes(path, PosixFileAttributes.class); } catch (Exception e) { e.printStackTrace(); } System.out.println("File owner: " + attr.owner().getName()); System.out.println("File group: " + attr.group().getName()); System.out.println("File permissions: " + attr.permissions().toString());
Files.getFileAttributeView().readAttributes()
Path path = Paths.get("/home/icer/note.txt"); PosixFileAttributes attr = null; try { attr = Files.getFileAttributeView(path, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); } catch (Exception e) { e.printStackTrace(); } System.out.println("File owner: " + attr.owner().getName()); System.out.println("File group: " + attr.group().getName()); System.out.println("File permissions: " + attr.permissions().toString());
POSIX的属性可以被要求以下列名称
1) group 2) permissions
notes:在Unix或linux上运行
相关文章推荐
- Posix消息队列的基本操作——获取消息属性
- 【Android】在控件、视图绘制或改变之后如何获取其部分状态和属性(比如高、宽、TextView绘制后的文字行数等)
- C# .NET System.Environment类 获取系统属性
- JS在EditPus中无法通过getAttribute()获取class属性---解决办法
- hibernate动态绑定查询,获取对象的private属性
- 查找SQL数据表或视图中的字段属性信息
- Android 反射机制获取或设置系统属性(SystemProperties)
- JavaScript 获取未知对象的属性
- php获取ip的三个属性区别介绍(HTTP_X_FORWARDED_FOR,HTTP_VIA,REMOTE_ADDR)
- screen对象的常用视图属性
- Js获取当前页面URL的一些属性
- freemarker获取封装类中对象的属性
- [原创]如何解决IE10下CkEditor报 --- SCRIPT5007: 无法获取未定义或 null 引用的属性“toLowerCase”
- 在设置UIView及子视图的frame属性的注意事项
- 《Day1 获取不在同一页面的样式属性》
- CSS之window的视图属性
- C#,利用反射获取私有成员或属性
- 如何获取对象建表、视图和建索引的语法
- 【20150525-20150529】sql、oracle方向总结(truncate、execute、exception、系统视图与表属性)
- PHP与JS混编 获取数组、日期转换、控件属性控制