test/java/nio/file/Files/PassThroughFileSystem.java

Print this page
rev 7023 : 8006884: (fs) Add Files.list, lines and find
Reviewed-by:
Contributed-by: alan.bateman@oracle.com, henry.jen@oracle.com
   1 /*
   2  * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 287                         public Path next() {
 288                             return new PassThroughPath(delegate, itr.next());
 289                         }
 290                         @Override
 291                         public void remove() {
 292                             itr.remove();
 293                         }
 294                     };
 295                 }
 296                 @Override
 297                 public void close() throws IOException {
 298                     stream.close();
 299                 }
 300             };
 301         }
 302 
 303         @Override
 304         public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter)
 305             throws IOException
 306         {
 307             return wrap(Files.newDirectoryStream(dir, filter));
 308         }
 309 
 310         @Override
 311         public void createDirectory(Path dir, FileAttribute<?>... attrs)
 312             throws IOException
 313         {
 314             Files.createDirectory(unwrap(dir), attrs);
 315         }
 316 
 317         @Override
 318         public SeekableByteChannel newByteChannel(Path file,
 319                                                   Set<? extends OpenOption> options,
 320                                                   FileAttribute<?>... attrs)
 321             throws IOException
 322         {
 323             return Files.newByteChannel(unwrap(file), options, attrs);
 324         }
 325 
 326 
 327         @Override


   1 /*
   2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 287                         public Path next() {
 288                             return new PassThroughPath(delegate, itr.next());
 289                         }
 290                         @Override
 291                         public void remove() {
 292                             itr.remove();
 293                         }
 294                     };
 295                 }
 296                 @Override
 297                 public void close() throws IOException {
 298                     stream.close();
 299                 }
 300             };
 301         }
 302 
 303         @Override
 304         public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter)
 305             throws IOException
 306         {
 307             return wrap(Files.newDirectoryStream(unwrap(dir), filter));
 308         }
 309 
 310         @Override
 311         public void createDirectory(Path dir, FileAttribute<?>... attrs)
 312             throws IOException
 313         {
 314             Files.createDirectory(unwrap(dir), attrs);
 315         }
 316 
 317         @Override
 318         public SeekableByteChannel newByteChannel(Path file,
 319                                                   Set<? extends OpenOption> options,
 320                                                   FileAttribute<?>... attrs)
 321             throws IOException
 322         {
 323             return Files.newByteChannel(unwrap(file), options, attrs);
 324         }
 325 
 326 
 327         @Override