Class FastCDC

java.lang.Object
utils.FastCDC

public class FastCDC extends Object
A class with methods to execute content defined chunking. Implemented using the following paper: this as a base
  • Constructor Details

  • Method Details

    • getBreakpoint

      public int getBreakpoint(byte[] buffer, int length)
      Gets the next breakpoint of the passed bytes and returns it
      Parameters:
      buffer - The bytes to check
      length - The length of the buffer
      Returns:
      The breakpoint of the passed bytes
    • getChunks

      public List<byte[]> getChunks(InputStream inputStream) throws CDCException
      Performs FastCDC on an InputStream and returns the chunks
      Parameters:
      inputStream - The InputStream to perform CDC on
      Returns:
      The found chunks
      Throws:
      CDCException - if CDC fails
    • forEachChunk

      public void forEachChunk(InputStream inputStream, BiConsumer<byte[],Integer> consumer) throws CDCException
      Finds all the chunks of a provided input stream and allows the use of a consumer to execute operations on each chunk
      Parameters:
      inputStream - the to chunk
      consumer - the consumer to execute
      Throws:
      CDCException - if the CDC failed