- All Known Implementing Classes:
SimpleChunk
public interface Chunk
Interface representing chunked data as created by a
Chunker.
Chunks own their data, hence it is preferable to keep their lifetime short and collect necessary information as soon as possible.
- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
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.default ChunkMetadatatoChunkMetadata()Converts this chunk to its corresponding metadata.
-
Method Details
-
getData
byte[] getData()Gets the data contained in this chunk.- Returns:
- The contained data
-
getHash
byte[] getHash()A binary hash representation of the contained data. Using the algorithm specified during construction by theChunker.- Returns:
- A binary hash representation
-
getHexHash
java.lang.String getHexHash()A hexadecimal hash representation of the contained data. Using the algorithm specified during construction by theChunker.- Returns:
- A hexadecimal hash representation
-
getLength
int getLength()The length of this chunk, i.e. the amount of contained data.- Returns:
- Gets the length
-
getOffset
long getOffset()Gets the offset of this chunk, with respect to its source data stream.- Returns:
- The offset
-
toChunkMetadata
Converts this chunk to its corresponding metadata.- Returns:
- The metadata
-