ChunkableContent implements Iterable<ChunkInputStream>, Iterator<ChunkInputStream> { public ChunksManifest finalizeManifest() { addEntry(); manifest.setMD5OfSourceContent(largeStream.getMD5()); IOUtils.closeQuietly(largeStream); return manifest; } ChunkableContent(String contentId,
                            InputStream largeStream,
                            long contentSize,
                            long maxChunkSize);  ChunkableContent(String contentId,
                            String contentMimetype,
                            InputStream largeStream,
                            long contentSize,
                            long maxChunkSize); boolean hasNext(); ChunkInputStream next(); void remove(); Iterator<ChunkInputStream> iterator(); void setPreserveChunkMD5s(boolean preserveChunkMD5s); long getMaxChunkSize(); ChunksManifest getManifest(); ChunksManifest finalizeManifest();  }
@Test public void testManifest() throws Exception { doChunking(); ChunksManifest manifest = chunkable.finalizeManifest(); Assert.assertNotNull(manifest); ChunksManifestBean.ManifestHeader header = manifest.getHeader(); Assert.assertNotNull(header); List<ChunksManifestBean.ManifestEntry> entries = manifest.getEntries(); Assert.assertNotNull(entries); Assert.assertEquals(chunkFiles.size(), entries.size()); KnownLengthInputStream body = manifest.getBody(); Assert.assertNotNull(body); Assert.assertTrue(body.getLength() > 0); }