Class Murmur3_32HashFunction.Murmur3_32Hasher

java.lang.Object
com.google.common.hash.AbstractHasher
com.google.common.hash.Murmur3_32HashFunction.Murmur3_32Hasher
All Implemented Interfaces:
Hasher, PrimitiveSink
Enclosing class:
Murmur3_32HashFunction

private static final class Murmur3_32HashFunction.Murmur3_32Hasher extends AbstractHasher
  • Field Details

    • h1

      private int h1
    • buffer

      private long buffer
    • shift

      private int shift
    • length

      private int length
    • isDone

      private boolean isDone
  • Constructor Details

    • Murmur3_32Hasher

      Murmur3_32Hasher(int seed)
  • Method Details

    • update

      private void update(int nBytes, long update)
    • 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(ByteBuffer buffer)
      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:
      buffer - a byte buffer
      Returns:
      this instance
    • putInt

      public Hasher putInt(int i)
      Description copied from interface: PrimitiveSink
      Puts an int into this sink.
      Specified by:
      putInt in interface Hasher
      Specified by:
      putInt in interface PrimitiveSink
      Overrides:
      putInt in class AbstractHasher
    • putLong

      public Hasher putLong(long l)
      Description copied from interface: PrimitiveSink
      Puts a long into this sink.
      Specified by:
      putLong in interface Hasher
      Specified by:
      putLong in interface PrimitiveSink
      Overrides:
      putLong in class AbstractHasher
    • putChar

      public Hasher putChar(char c)
      Description copied from interface: PrimitiveSink
      Puts a character into this sink.
      Specified by:
      putChar in interface Hasher
      Specified by:
      putChar in interface PrimitiveSink
      Overrides:
      putChar in class AbstractHasher
    • putString

      public Hasher putString(CharSequence input, Charset charset)
      Description copied from interface: Hasher
      Equivalent to putBytes(charSequence.toString().getBytes(charset)).

      Warning: This method, which reencodes the input before hashing it, is useful only for cross-language compatibility. For other use cases, prefer Hasher.putUnencodedChars(java.lang.CharSequence), which is faster, produces the same output across Java releases, and hashes every char in the input, even if some are invalid.

      Specified by:
      putString in interface Hasher
      Specified by:
      putString in interface PrimitiveSink
      Overrides:
      putString in class AbstractHasher
    • 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.