Package com.fasterxml.storemate.shared.hash

Examples of com.fasterxml.storemate.shared.hash.IncrementalMurmur3Hasher


    public static int calcChecksum(byte[] data) {
        return calcChecksum(data, 0, data.length);
    }

    public static IncrementalHasher32 startChecksum() {
      return new IncrementalMurmur3Hasher();
    }
View Full Code Here


public class TestCountingStreams extends StoreTestBase
{
    public void testCountingInputStream() throws Exception
    {
        byte[] INPUT = new byte[] { 1, 2, 3, 4, 5, 6, 7, };
        CountingInputStream in = new CountingInputStream(new ByteArrayInputStream(INPUT), new IncrementalMurmur3Hasher());

        assertEquals(1, in.read());
        byte[] buffer = new byte[8];
        assertEquals(4, in.read(buffer, 2, 4));
        for (int i = 0; i < 4; ++i) {
View Full Code Here

    }

    public void testCountingOutputStream() throws Exception
    {
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        CountingOutputStream out = new CountingOutputStream(bytes, new IncrementalMurmur3Hasher());
       
        byte[] INPUT = new byte[] { 1, 2, 3, 4, 5, 6, 7, };
        out.write(INPUT, 0, 7);
        out.write(8);
View Full Code Here

        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        aggr.writeTo(bytes);
        assertEquals(LEN, bytes.size());

        // also: better calculate hash/checksum correctly
        final IncrementalMurmur3Hasher hasher = new IncrementalMurmur3Hasher();
        aggr.calcChecksum(hasher);
        assertEquals(hash, hasher.calculateHash());
       
        aggr.close();
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.storemate.shared.hash.IncrementalMurmur3Hasher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.