OdsArchiveExplorer { public Map<String, OdsFile> explore() throws IOException { final ZipInputStream zipStream = new ZipInputStream(this.sourceStream); ZipEntry zipEntry = zipStream.getNextEntry(); while (zipEntry != null) { final String name = zipEntry.getName(); final byte[] bytes = this.fileUtil.readStream(zipStream); if (name.equals(ManifestElement.META_INF_MANIFEST_XML)) { this.extractMediaTypeByName(bytes); } this.putBytes(name, bytes); zipEntry = zipStream.getNextEntry(); } return this.fileByName; } OdsArchiveExplorer(final FileUtil fileUtil, final InputStream sourceStream); Map<String, OdsFile> explore();  }
@Test public void test() throws IOException { final byte[] bytes = this.createArchiveAsBytes(); final OdsArchiveExplorer ae = new OdsArchiveExplorer(FileUtil.create(), new ByteArrayInputStream(bytes)); final Map<String, OdsArchiveExplorer.OdsFile> fileNyName = ae.explore(); Assert.assertEquals(3, fileNyName.size()); Assert.assertEquals(this.getOdsFile("temp1", "media/type1", new byte[]{0x01}), fileNyName.get("temp1")); Assert.assertEquals(this.getOdsFile("temp2", "media/type2", new byte[]{0x02}), fileNyName.get("temp2")); Assert.assertEquals(this.getOdsFile(ManifestElement.META_INF_MANIFEST_XML, null, MANIFEST.getBytes(CharsetUtil.UTF_8)), fileNyName.get(ManifestElement.META_INF_MANIFEST_XML)); }