Class SimpleChunkMetadata

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.String getHexHash()
    A hexadecimal hash representation of the contained data.
    int getLength()
    The length of this chunk, i.e. the amount of contained data.
    long getOffset()
    Gets the offset of this chunk, with respect to its source data stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 positive
      length - The length of this chunk, i.e. the amount of contained data, must be positive and not zero
      hash - A binary hash representation of the contained data. Using the algorithm specified during construction by the Chunker. Not null and not empty.
      hexHash - A hexadecimal hash representation of the contained data. Using the algorithm specified during construction by the Chunker. Not null and not empty.
  • Method Details

    • getHash

      public byte[] getHash()
      Description copied from interface: ChunkMetadata
      A binary hash representation of the contained data. Using the algorithm specified during construction by the Chunker.
      Specified by:
      getHash in interface ChunkMetadata
      Returns:
      A binary hash representation
    • getHexHash

      public java.lang.String getHexHash()
      Description copied from interface: ChunkMetadata
      A hexadecimal hash representation of the contained data. Using the algorithm specified during construction by the Chunker.
      Specified by:
      getHexHash in interface ChunkMetadata
      Returns:
      A hexadecimal hash representation
    • getLength

      public int getLength()
      Description copied from interface: ChunkMetadata
      The length of this chunk, i.e. the amount of contained data.
      Specified by:
      getLength in interface ChunkMetadata
      Returns:
      Gets the length
    • getOffset

      public long getOffset()
      Description copied from interface: ChunkMetadata
      Gets the offset of this chunk, with respect to its source data stream.
      Specified by:
      getOffset in interface ChunkMetadata
      Returns:
      The offset