Skip to content

This package implements the "FastCDC" content defined chunking algorithm in Java. This package started as Java port of the implementation by Nathan Fiedler, and the code refer to `iscc/fastcdc-py`

License

Notifications You must be signed in to change notification settings

Farley-Chen/fastcdc-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This package implements the "FastCDC" content defined chunking algorithm in Java.

This package started as Java port of the implementation by Nathan Fiedler, and the code refer to iscc/fastcdc-py

Usage

<dependency>
    <groupId>io.github.Farley-Chen</groupId>
    <artifactId>fastcdc-java</artifactId>
    <version>1.0.2</version>
</dependency>
package io.github.farleychen.fastcdc;

import org.apache.commons.codec.digest.DigestUtils;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class Example {

    public static void main(final String[] args) throws IOException {
        try (final var inputStream = Files.newInputStream(Path.of("xxx"))) {
            final var chunkIterator = FastCDC.chunk(
                inputStream, new FastCDCOption().setAvgSize(16384)
                    .setMinSize(8192)
                    .setMaxSize(32768)
                    .setFetchData(true)
                    .setHashFunction(DigestUtils::md5Hex));
            chunkIterator.forEachRemaining(chunk -> {
                System.out.println(chunk.getOffset());
                System.out.println(chunk.getLength());
                System.out.println(chunk.getHash());
            });
        }
    }

}

About

This package implements the "FastCDC" content defined chunking algorithm in Java. This package started as Java port of the implementation by Nathan Fiedler, and the code refer to `iscc/fastcdc-py`

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages