Module de.zabuza.fastcdc4j
Class IterativeStreamChunker
java.lang.Object
de.zabuza.fastcdc4j.internal.chunking.IterativeStreamChunker
- All Implemented Interfaces:
Chunker
public final class IterativeStreamChunker extends java.lang.Object implements Chunker
Implementation of a chunker that iteratively chunks the stream by using a given
IterativeStreamChunkerCore as
core for the chunking behavior.- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
Constructor Summary
Constructors Constructor Description IterativeStreamChunker(IterativeStreamChunkerCore core, java.lang.String hashMethod)Creates a new chunker. -
Method Summary
-
Constructor Details
-
IterativeStreamChunker
Creates a new chunker.- Parameters:
core- The core to use for chunking, not nullhashMethod- The hash method to use for hashing the data of a chunk, has to be supported and accepted byMessageDigest
-
-
Method Details
-
chunk
Description copied from interface:ChunkerChunks the given stream into chunks. The stream is consumed and populates the resulting iterable lazily as it is consumed.Chunks own their bytes, so it is preferable to process them directly and avoid first collecting all of them.
- Specified by:
chunkin interfaceChunker- Parameters:
stream- The data stream to chunk, not nullsize- The amount of bytes available in the stream that are subject to be chunked, the stream must offer at least that many bytes. Must be positive and not zero.- Returns:
- The chunks of the stream, lazily populated
-