private Set<MultiChunk> chunkFileIntoMultiChunks(File tempDir, List<File> files, Chunker foc, MultiChunker customMultiChunker, Transformer transformer)
throws IOException {
Set<MultiChunk> resultMultiChunks = new HashSet<MultiChunk>();
MultiChunk customMultiChunk = createNewMultiChunk(tempDir, customMultiChunker, transformer);
for (File file : files) {
Enumeration<Chunk> chunks = foc.createChunks(file);
while (chunks.hasMoreElements()) {
Chunk chunk = chunks.nextElement();
customMultiChunk.write(chunk);
if (customMultiChunk.isFull()) {
customMultiChunk.close();
resultMultiChunks.add(customMultiChunk);
customMultiChunk = createNewMultiChunk(tempDir, customMultiChunker, transformer);
}
}
}
customMultiChunk.close();
resultMultiChunks.add(customMultiChunk);
return resultMultiChunks;
}