java.lang.Object
de.zabuza.fastcdc4j.internal.chunking.FastCdcChunkerCore
- All Implemented Interfaces:
IterativeStreamChunkerCore
public final class FastCdcChunkerCore extends java.lang.Object implements IterativeStreamChunkerCore
Implementation of an iterative stream chunker core that chunks according to the FastCDC algorithm (by Wen Xia et al.
(publication)).
- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
Constructor Summary
Constructors Constructor Description FastCdcChunkerCore(int expectedSize, int minSize, int maxSize, long[] gear, long maskSmall, long maskLarge)Creates a new core. -
Method Summary
Modifier and Type Method Description byte[]readNextChunk(java.io.InputStream stream, long size, long currentOffset)Reads the next chunk from the given data stream.
-
Constructor Details
-
FastCdcChunkerCore
public FastCdcChunkerCore(int expectedSize, int minSize, int maxSize, long[] gear, long maskSmall, long maskLarge)Creates a new core.- Parameters:
expectedSize- The expected size for a single chunk, in bytes, must be positiveminSize- The minimal size for a single chunk, in bytes, must be positive and less equals expected sizemaxSize- The maximal size for a single chunk, in bytes, must be positive and greater equals expected sizegear- The hash table, also known asgearused as noise to improve the splitting behavior for relatively similar content, must have a length of exactly 256, one hash per byte valuemaskSmall- Mask for the fingerprint that is used for smaller windows, to decrease the likelihood of a splitmaskLarge- Mask for the fingerprint that is used for bigger windows, to increase the likelihood of a split
-
-
Method Details
-
readNextChunk
public byte[] readNextChunk(java.io.InputStream stream, long size, long currentOffset)Description copied from interface:IterativeStreamChunkerCoreReads the next chunk from the given data stream. The stream is consumed by exactly the length of the provided chunk. The stream is safe to be read byte by byte, it provides buffering methods if necessary.- Specified by:
readNextChunkin interfaceIterativeStreamChunkerCore- Parameters:
stream- The data stream to chunk, not nullsize- Remaining data available in the stream that are subject to be chunked, must be positive and not zerocurrentOffset- Current offset in the given stream, in regards to its original start, must be positive and less than size- Returns:
- The chunk that was read
-