< prev index next >

test/jdk/jdk/nio/zipfs/Basic.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 21,31 **** * questions. */ import java.nio.file.AccessMode; import java.nio.file.ClosedFileSystemException; - import java.nio.file.DirectoryStream; import java.nio.file.FileStore; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; import java.nio.file.Files; --- 21,30 ----
*** 85,120 **** } // Test: exercise directory iterator and retrieval of basic attributes Files.walkFileTree(fs.getPath("/"), new FileTreePrinter()); - // Test: DirectoryStream - found = false; - - try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/"))) { - for (Path entry: stream) { - found = entry.toString().equals("/META-INF"); - if (found) break; - } - } - if (!found) - throw new RuntimeException("Expected file not found"); - - try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("META-INF"))) { - for (Path entry: stream) { - if (entry.toString().equals("/META-INF/services")) - throw new RuntimeException("child path should be relative"); - } - } - - try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/META-INF"))) { - for (Path entry: stream) { - if (entry.toString().equals("META-INF/services")) - throw new RuntimeException("child path should be absolute"); - } - } - // Test: copy file from zip file to current (scratch) directory Path source = fs.getPath("/META-INF/services/java.nio.file.spi.FileSystemProvider"); if (Files.exists(source)) { Path target = Paths.get(source.getFileName().toString()); Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING); --- 84,93 ----
< prev index next >