Class AbstractNonStreamingHashFunction.BufferingHasher

    • Constructor Detail

      • BufferingHasher

        BufferingHasher​(int expectedInputSize)
    • Method Detail

      • putByte

        public Hasher putByte​(byte b)
        Description copied from interface: PrimitiveSink
        Puts a byte into this sink.
        Parameters:
        b - a byte
        Returns:
        this instance
      • putBytes

        public Hasher putBytes​(byte[] bytes,
                               int off,
                               int len)
        Description copied from interface: PrimitiveSink
        Puts a chunk of an array of bytes into this sink. bytes[off] is the first byte written, bytes[off + len - 1] is the last.
        Specified by:
        putBytes in interface Hasher
        Specified by:
        putBytes in interface PrimitiveSink
        Overrides:
        putBytes in class AbstractHasher
        Parameters:
        bytes - a byte array
        off - the start offset in the array
        len - the number of bytes to write
        Returns:
        this instance
      • putBytes

        public Hasher putBytes​(java.nio.ByteBuffer bytes)
        Description copied from interface: PrimitiveSink
        Puts the remaining bytes of a byte buffer into this sink. bytes.position() is the first byte written, bytes.limit() - 1 is the last. The position of the buffer will be equal to the limit when this method returns.
        Specified by:
        putBytes in interface Hasher
        Specified by:
        putBytes in interface PrimitiveSink
        Overrides:
        putBytes in class AbstractHasher
        Parameters:
        bytes - a byte buffer
        Returns:
        this instance
      • hash

        public HashCode hash()
        Description copied from interface: Hasher
        Computes a hash code based on the data that have been provided to this hasher. The result is unspecified if this method is called more than once on the same instance.