jdk/test/java/nio/file/spi/TestProvider.java
changeset 45004 ea3137042a61
parent 36511 9d0388c6b336
equal deleted inserted replaced
44789:73fd39e0702e 45004:ea3137042a61
    75     @Override
    75     @Override
    76     public void setAttribute(Path file, String attribute, Object value,
    76     public void setAttribute(Path file, String attribute, Object value,
    77                              LinkOption... options)
    77                              LinkOption... options)
    78         throws IOException
    78         throws IOException
    79     {
    79     {
    80         throw new ReadOnlyFileSystemException();
    80         throw new RuntimeException("not implemented");
    81     }
    81     }
    82 
    82 
    83     @Override
    83     @Override
    84     public Map<String,Object> readAttributes(Path file, String attributes,
    84     public Map<String,Object> readAttributes(Path file, String attributes,
    85                                              LinkOption... options)
    85                                              LinkOption... options)
   108         return defaultProvider.getFileAttributeView(delegate, type, options);
   108         return defaultProvider.getFileAttributeView(delegate, type, options);
   109     }
   109     }
   110 
   110 
   111     @Override
   111     @Override
   112     public void delete(Path file) throws IOException {
   112     public void delete(Path file) throws IOException {
   113         throw new ReadOnlyFileSystemException();
   113         Path delegate = theFileSystem.unwrap(file);
       
   114         defaultProvider.delete(delegate);
   114     }
   115     }
   115 
   116 
   116     @Override
   117     @Override
   117     public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
   118     public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
   118         throws IOException
   119         throws IOException
   119     {
   120     {
   120         throw new ReadOnlyFileSystemException();
   121         throw new RuntimeException("not implemented");
   121     }
   122     }
   122 
   123 
   123     @Override
   124     @Override
   124     public void createLink(Path link, Path existing) throws IOException {
   125     public void createLink(Path link, Path existing) throws IOException {
   125         throw new ReadOnlyFileSystemException();
   126         throw new RuntimeException("not implemented");
   126     }
   127     }
   127 
   128 
   128     @Override
   129     @Override
   129     public Path readSymbolicLink(Path link) throws IOException {
   130     public Path readSymbolicLink(Path link) throws IOException {
   130         Path delegate = theFileSystem.unwrap(link);
   131         Path delegate = theFileSystem.unwrap(link);
   134 
   135 
   135     @Override
   136     @Override
   136     public void copy(Path source, Path target, CopyOption... options)
   137     public void copy(Path source, Path target, CopyOption... options)
   137         throws IOException
   138         throws IOException
   138     {
   139     {
   139         throw new ReadOnlyFileSystemException();
   140         throw new RuntimeException("not implemented");
   140     }
   141     }
   141 
   142 
   142     @Override
   143     @Override
   143     public void move(Path source, Path target, CopyOption... options)
   144     public void move(Path source, Path target, CopyOption... options)
   144         throws IOException
   145         throws IOException
   145     {
   146     {
   146         throw new ReadOnlyFileSystemException();
   147         throw new RuntimeException("not implemented");
   147     }
   148     }
   148 
   149 
   149     @Override
   150     @Override
   150     public DirectoryStream<Path> newDirectoryStream(Path dir,
   151     public DirectoryStream<Path> newDirectoryStream(Path dir,
   151                                                     DirectoryStream.Filter<? super Path> filter)
   152                                                     DirectoryStream.Filter<? super Path> filter)
   156 
   157 
   157     @Override
   158     @Override
   158     public void createDirectory(Path dir, FileAttribute<?>... attrs)
   159     public void createDirectory(Path dir, FileAttribute<?>... attrs)
   159         throws IOException
   160         throws IOException
   160     {
   161     {
   161         throw new ReadOnlyFileSystemException();
   162         Path delegate = theFileSystem.unwrap(dir);
       
   163         defaultProvider.createDirectory(delegate, attrs);
   162     }
   164     }
   163 
   165 
   164     @Override
   166     @Override
   165     public SeekableByteChannel newByteChannel(Path file,
   167     public SeekableByteChannel newByteChannel(Path file,
   166                                               Set<? extends OpenOption> options,
   168                                               Set<? extends OpenOption> options,
   167                                               FileAttribute<?>... attrs)
   169                                               FileAttribute<?>... attrs)
   168         throws IOException
   170         throws IOException
   169     {
   171     {
   170         if (options.contains(StandardOpenOption.READ) && options.size() == 1) {
   172         Path delegate = theFileSystem.unwrap(file);
   171             Path delegate = theFileSystem.unwrap(file);
   173         return defaultProvider.newByteChannel(delegate, options, attrs);
   172             options = Collections.singleton(StandardOpenOption.READ);
       
   173             return defaultProvider.newByteChannel(delegate, options, attrs);
       
   174         }
       
   175 
       
   176         throw new RuntimeException("not implemented");
       
   177     }
   174     }
   178 
   175 
   179     @Override
   176     @Override
   180     public boolean isHidden(Path file) throws IOException {
   177     public boolean isHidden(Path file) throws IOException {
   181         throw new ReadOnlyFileSystemException();
   178         throw new ReadOnlyFileSystemException();
   234             return true;
   231             return true;
   235         }
   232         }
   236 
   233 
   237         @Override
   234         @Override
   238         public boolean isReadOnly() {
   235         public boolean isReadOnly() {
   239             return true;
   236             return false;
   240         }
   237         }
   241 
   238 
   242         @Override
   239         @Override
   243         public String getSeparator() {
   240         public String getSeparator() {
   244             return delegate.getSeparator();
   241             return delegate.getSeparator();
   417             return fs.wrap(delegate.toRealPath(options));
   414             return fs.wrap(delegate.toRealPath(options));
   418         }
   415         }
   419 
   416 
   420         @Override
   417         @Override
   421         public File toFile() {
   418         public File toFile() {
   422             return delegate.toFile();
   419             return new File(toString());
   423         }
   420         }
   424 
   421 
   425         @Override
   422         @Override
   426         public Iterator<Path> iterator() {
   423         public Iterator<Path> iterator() {
   427             final Iterator<Path> itr = delegate.iterator();
   424             final Iterator<Path> itr = delegate.iterator();