java.lang.Object
de.zabuza.fastcdc4j.internal.chunking.SimpleChunk
- All Implemented Interfaces:
Chunk
public final class SimpleChunk extends java.lang.Object implements Chunk
Implementation of a simple chunk, wrapping given data.
The getHexHash() is cached and will be generated upon construction.
- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
Constructor Summary
Constructors Constructor Description SimpleChunk(byte[] data, long offset, byte[] hash)Creates a new simple chunk. -
Method Summary
Modifier and Type Method Description byte[]getData()Gets the data contained in this chunk.byte[]getHash()A binary hash representation of the contained data.java.lang.StringgetHexHash()A hexadecimal hash representation of the contained data.intgetLength()The length of this chunk, i.e. the amount of contained data.longgetOffset()Gets the offset of this chunk, with respect to its source data stream.
-
Constructor Details
-
SimpleChunk
public SimpleChunk(byte[] data, long offset, byte[] hash)Creates a new simple chunk.The
getHexHash()is cached and will be generated upon construction based on the given hash.- Parameters:
data- The data contained in this chunk, not null and not emptyoffset- The offset of this chunk, with respect to its source data stream, must be positivehash- A binary hash representation of the contained data. Using the algorithm specified during construction by theChunker. Not null and not empty.
-
-
Method Details
-
getData
public byte[] getData()Description copied from interface:ChunkGets the data contained in this chunk. -
getHash
public byte[] getHash()Description copied from interface:ChunkA binary hash representation of the contained data. Using the algorithm specified during construction by theChunker. -
getHexHash
public java.lang.String getHexHash()Description copied from interface:ChunkA hexadecimal hash representation of the contained data. Using the algorithm specified during construction by theChunker.- Specified by:
getHexHashin interfaceChunk- Returns:
- A hexadecimal hash representation
-
getLength
public int getLength()Description copied from interface:ChunkThe length of this chunk, i.e. the amount of contained data. -
getOffset
public long getOffset()Description copied from interface:ChunkGets the offset of this chunk, with respect to its source data stream.
-