jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java
changeset 8158 77d9c0f1c19f
parent 5506 202f599c92aa
child 8808 fc799c458da8
equal deleted inserted replaced
7988:d31b7cc371ef 8158:77d9c0f1c19f
   147         public String name() {
   147         public String name() {
   148             return "posix";
   148             return "posix";
   149         }
   149         }
   150 
   150 
   151         @Override
   151         @Override
   152         public Object getAttribute(String attribute) throws IOException {
       
   153             if (attribute.equals(PERMISSIONS_NAME))
       
   154                 return readAttributes().permissions();
       
   155             if (attribute.equals(OWNER_NAME))
       
   156                 return readAttributes().owner();
       
   157             if (attribute.equals(GROUP_NAME))
       
   158                 return readAttributes().group();
       
   159             return super.getAttribute(attribute);
       
   160         }
       
   161 
       
   162         @Override
       
   163         @SuppressWarnings("unchecked")
   152         @SuppressWarnings("unchecked")
   164         public void setAttribute(String attribute, Object value)
   153         public void setAttribute(String attribute, Object value)
   165             throws IOException
   154             throws IOException
   166         {
   155         {
   167             if (attribute.equals(PERMISSIONS_NAME)) {
   156             if (attribute.equals(PERMISSIONS_NAME)) {
   193             if (builder.match(GROUP_NAME))
   182             if (builder.match(GROUP_NAME))
   194                 builder.add(GROUP_NAME, attrs.group());
   183                 builder.add(GROUP_NAME, attrs.group());
   195         }
   184         }
   196 
   185 
   197         @Override
   186         @Override
   198         public Map<String,?> readAttributes(String[] attributes)
   187         public Map<String,Object> readAttributes(String[] attributes)
   199             throws IOException
   188             throws IOException
   200         {
   189         {
   201             AttributesBuilder builder = AttributesBuilder.create(attributes);
   190             AttributesBuilder builder = AttributesBuilder.create(attributes);
   202             PosixFileAttributes attrs = readAttributes();
   191             PosixFileAttributes attrs = readAttributes();
   203             addBasicAttributesToBuilder(attrs, builder);
   192             addBasicAttributesToBuilder(attrs, builder);
   306         public String name() {
   295         public String name() {
   307             return "unix";
   296             return "unix";
   308         }
   297         }
   309 
   298 
   310         @Override
   299         @Override
   311         public Object getAttribute(String attribute) throws IOException {
       
   312             if (attribute.equals(MODE_NAME))
       
   313                 return readAttributes().mode();
       
   314             if (attribute.equals(INO_NAME))
       
   315                 return readAttributes().ino();
       
   316             if (attribute.equals(DEV_NAME))
       
   317                 return readAttributes().dev();
       
   318             if (attribute.equals(RDEV_NAME))
       
   319                 return readAttributes().rdev();
       
   320             if (attribute.equals(NLINK_NAME))
       
   321                 return readAttributes().nlink();
       
   322             if (attribute.equals(UID_NAME))
       
   323                 return readAttributes().uid();
       
   324             if (attribute.equals(GID_NAME))
       
   325                 return readAttributes().gid();
       
   326             if (attribute.equals(CTIME_NAME))
       
   327                 return readAttributes().ctime();
       
   328             return super.getAttribute(attribute);
       
   329         }
       
   330 
       
   331         @Override
       
   332         public void setAttribute(String attribute, Object value)
   300         public void setAttribute(String attribute, Object value)
   333             throws IOException
   301             throws IOException
   334         {
   302         {
   335             if (attribute.equals(MODE_NAME)) {
   303             if (attribute.equals(MODE_NAME)) {
   336                 setMode((Integer)value);
   304                 setMode((Integer)value);
   346             }
   314             }
   347             super.setAttribute(attribute, value);
   315             super.setAttribute(attribute, value);
   348         }
   316         }
   349 
   317 
   350         @Override
   318         @Override
   351         public Map<String,?> readAttributes(String[] attributes)
   319         public Map<String,Object> readAttributes(String[] attributes)
   352             throws IOException
   320             throws IOException
   353         {
   321         {
   354             AttributesBuilder builder = AttributesBuilder.create(attributes);
   322             AttributesBuilder builder = AttributesBuilder.create(attributes);
   355             UnixFileAttributes attrs = readAttributes();
   323             UnixFileAttributes attrs = readAttributes();
   356             addBasicAttributesToBuilder(attrs, builder);
   324             addBasicAttributesToBuilder(attrs, builder);