ZipFiles { static CharSource asCharSource(ZipFile file, ZipEntry entry, Charset charset) { return asByteSource(file, entry).asCharSource(charset); } private  ZipFiles(); static void zipDirectory(File sourceDirectory, File zipFile); static void zipDirectory(File sourceDirectory, OutputStream outputStream);  }
@Test public void testAsCharSource() throws Exception { File zipDir = new File(tmpDir, "zip"); assertTrue(zipDir.mkdirs()); createFileWithContents(zipDir, "myTextFile.txt", "Simple Text"); ZipFiles.zipDirectory(tmpDir, zipFile); try (ZipFile zip = new ZipFile(zipFile)) { ZipEntry entry = zip.getEntry("zip/myTextFile.txt"); CharSource charSource = ZipFiles.asCharSource(zip, entry, StandardCharsets.UTF_8); assertEquals("Simple Text", charSource.read()); } }