java.lang.Object
de.zabuza.fastcdc4j.internal.chunking.SimpleChunkMetadata
- All Implemented Interfaces:
ChunkMetadata
public final class SimpleChunkMetadata extends java.lang.Object implements ChunkMetadata
Implementation of a simple chunk metadata, wrapping given data.
- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
Constructor Summary
Constructors Constructor Description SimpleChunkMetadata(long offset, int length, byte[] hash, java.lang.String hexHash)Creates a new simple chunk. -
Method Summary
Modifier and Type Method Description 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
-
SimpleChunkMetadata
public SimpleChunkMetadata(long offset, int length, byte[] hash, java.lang.String hexHash)Creates a new simple chunk.- Parameters:
offset- The offset of this chunk, with respect to its source data stream, must be positivelength- The length of this chunk, i.e. the amount of contained data, must be positive and not zerohash- A binary hash representation of the contained data. Using the algorithm specified during construction by theChunker. Not null and not empty.hexHash- A hexadecimal hash representation of the contained data. Using the algorithm specified during construction by theChunker. Not null and not empty.
-
-
Method Details
-
getHash
public byte[] getHash()Description copied from interface:ChunkMetadataA binary hash representation of the contained data. Using the algorithm specified during construction by theChunker.- Specified by:
getHashin interfaceChunkMetadata- Returns:
- A binary hash representation
-
getHexHash
public java.lang.String getHexHash()Description copied from interface:ChunkMetadataA hexadecimal hash representation of the contained data. Using the algorithm specified during construction by theChunker.- Specified by:
getHexHashin interfaceChunkMetadata- Returns:
- A hexadecimal hash representation
-
getLength
public int getLength()Description copied from interface:ChunkMetadataThe length of this chunk, i.e. the amount of contained data.- Specified by:
getLengthin interfaceChunkMetadata- Returns:
- Gets the length
-
getOffset
public long getOffset()Description copied from interface:ChunkMetadataGets the offset of this chunk, with respect to its source data stream.- Specified by:
getOffsetin interfaceChunkMetadata- Returns:
- The offset
-