### Question:
PathUtil { public static Path readFile(Path src, Path tempDir) throws IOException { if(isFile(src)) { return src; } else { Path file = getFile(src); if(isArchive(file)) { Path relativePath = file.relativize(src); Path target = createTempDirectory(tempDir, "unarchive"); unzip(file, target); return readFile(target.resolve(relativePath), tempDir); } else { throw new FileNotFoundException(src.toString()); } } }  static void copyRecursively(final Path source, final Path target, boolean overwrite); static void deleteSilentlyRecursively(final Path path); static void deleteRecursively(final Path path); static final Path resolveSecurely(Path rootPath, String path); static final boolean isArchive(Path path); static final boolean isArchive(InputStream in); static List<ContentRepositoryElement> listFiles(final Path rootPath, Path tempDir, final ContentFilter filter); static Path createTempDirectory(Path dir, String prefix); static void unzip(Path zip, Path target); static String getFileExtension(Path path); static Path readFile(Path src, Path tempDir);  }### Answer:
@Test public void testReadFile() throws Exception { Path archive = root.resolve("test.zip"); try (ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(archive))) { ZipEntry entry = new ZipEntry("overlay.xhtml"); out.putNextEntry(entry); try (InputStream in = this.getClass().getClassLoader().getResourceAsStream("overlay.xhtml")) { StreamUtils.copyStream(in, out); } out.closeEntry(); entry = new ZipEntry("single/test/test.html"); out.putNextEntry(entry); try (InputStream in = this.getClass().getClassLoader().getResourceAsStream("overlay.xhtml")) { StreamUtils.copyStream(in, out); } out.closeEntry(); } try (InputStream in = this.getClass().getClassLoader().getResourceAsStream("overlay.xhtml")) { String content = readFileContent(in); Assert.assertEquals(readFileContent(PathUtil.readFile(archive.resolve("overlay.xhtml"), root)), content); Assert.assertEquals(readFileContent(PathUtil.readFile(archive.resolve("single/test/test.html"), root)), content); } try { readFileContent(PathUtil.readFile(archive.resolve("single/test.html"), root)); Assert.fail("Shouldn't find a file at " + archive.resolve("single/test.html")); } catch (FileNotFoundException ex) { } }