Class FP64

java.lang.Object
gw.util.fingerprint.FP64

public final class FP64 extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private long
     
    private static long[]
     
    private static final long
     
    private static final String
     
    private static final long
     
    private static final long
     
    private static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes this object to the fingerprint of the empty string.
    FP64(byte[] bytes)
    Initializes this object to the fingerprint of the byte array bytes, which must be non-null.
    FP64(byte[] bytes, int start, int length)
    Initializes this object to the fingerprint of the bytes bytes[start]..bytes[start+length-1].
    FP64(char[] chars)
    Initializes this object to the fingerprint of the character array chars, which must be non-null.
    FP64(char[] chars, int start, int length)
    Initializes this object to the fingerprint of the characters chars[start]..chars[start+length-1].
    FP64(FP64 fp)
    Initializes this fingerprint to a copy of fp, which must be non-null.
    FP64(InputStream stream)
    Initializes this object to the fingerprint of the bytes in stream, which must be non-null.
    Initializes this object to the fingerprint of the String s, which must be non-null.
    FP64(ByteBuffer buffer)
    Initializes this object to the fingerprint of the bytes in buffer, which must be non-null.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    extend(byte b)
    Extends this fingerprint by the byte b.
    extend(byte[] bytes)
    Extends this fingerprint by the bytes
    extend(byte[] bytes, int start, int len)
    Extends this fingerprint by the bytes bytes[offset]..bytes[offset+length-1].
    extend(char c)
    Extends this fingerprint by the character c.
    extend(char[] chars)
    Extends this fingerprint by the characters chars[start]..chars[start+length-1].
    extend(char[] chars, int start, int len)
    Extends this fingerprint by the characters chars[start]..chars[start+length-1].
    extend(int i)
    Extends this fingerprint by the integer i.
    extend(long i)
    Extends this fingerprint by the integer i.
    Extends this fingerprint by the bytes of the stream stream, which must be non-null.
    Extends this fingerprint by the characters of the String s, which must be non-null.
     
    long
     
    int
     
    byte[]
    Returns the value of this fingerprint as a newly-allocated array of 8 bytes.
    byte[]
    toBytes(byte[] buff)
    Returns the value of this fingerprint as an 8-byte array.
    Returns the value of this fingerprint as an unsigned integer encoded in base 16 (hexideicmal), padded with leading zeros to a total length of 16 characters.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • FP64

      public FP64()
      Initializes this object to the fingerprint of the empty string.
    • FP64

      public FP64(FP64 fp)
      Initializes this fingerprint to a copy of fp, which must be non-null.
    • FP64

      public FP64(String s)
      Initializes this object to the fingerprint of the String s, which must be non-null.
    • FP64

      public FP64(char[] chars)
      Initializes this object to the fingerprint of the character array chars, which must be non-null.
    • FP64

      public FP64(char[] chars, int start, int length)
      Initializes this object to the fingerprint of the characters chars[start]..chars[start+length-1].
    • FP64

      public FP64(byte[] bytes)
      Initializes this object to the fingerprint of the byte array bytes, which must be non-null.
    • FP64

      public FP64(byte[] bytes, int start, int length)
      Initializes this object to the fingerprint of the bytes bytes[start]..bytes[start+length-1].
    • FP64

      public FP64(InputStream stream) throws IOException
      Initializes this object to the fingerprint of the bytes in stream, which must be non-null.
      Throws:
      IOException - if an error is encountered reading stream.
    • FP64

      public FP64(ByteBuffer buffer) throws IOException
      Initializes this object to the fingerprint of the bytes in buffer, which must be non-null.
      Throws:
      IOException - if an error is encountered reading stream.
  • Method Details

    • toBytes

      public byte[] toBytes()
      Returns the value of this fingerprint as a newly-allocated array of 8 bytes.

      Important: If the output of this function is subsequently fingerprinted, the probabilistic guarantee is lost. That is, there is a much higher liklihood of fingerprint collisions if fingerprint values are themselves fingerprinted in any way.

    • toBytes

      public byte[] toBytes(byte[] buff)
      Returns the value of this fingerprint as an 8-byte array. Unlike toBytes(), this variant does not perform an allocation. Instead, the client passes in a buffer into which the fingerprint value is written. This can be used to get the values of a set of fingerprints without having to perform an allocation for each one.
      Parameters:
      buff - The buffer into which the bytes will be written. This array is required to be non-null and exactly 8 bytes in length. This buffer is returned.
    • toHexString

      public String toHexString()
      Returns the value of this fingerprint as an unsigned integer encoded in base 16 (hexideicmal), padded with leading zeros to a total length of 16 characters.

      Important: If the output of this function is subsequently fingerprinted, the probabilistic guarantee is lost. That is, there is a much higher liklihood of fingerprint collisions if fingerprint values are themselves fingerprinted in any way.

    • extend

      public FP64 extend(String s)
      Extends this fingerprint by the characters of the String s, which must be non-null.
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(char[] chars)
      Extends this fingerprint by the characters chars[start]..chars[start+length-1].
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(char[] chars, int start, int len)
      Extends this fingerprint by the characters chars[start]..chars[start+length-1].
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(byte[] bytes, int start, int len)
      Extends this fingerprint by the bytes bytes[offset]..bytes[offset+length-1].
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(byte[] bytes)
      Extends this fingerprint by the bytes
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(int i)
      Extends this fingerprint by the integer i.
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(long i)
      Extends this fingerprint by the integer i.
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(char c)
      Extends this fingerprint by the character c.
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(byte b)
      Extends this fingerprint by the byte b.
      Returns:
      the resulting fingerprint.
    • extend

      public FP64 extend(InputStream stream) throws IOException
      Extends this fingerprint by the bytes of the stream stream, which must be non-null.
      Returns:
      the resulting fingerprint.
      Throws:
      IOException - if an error is encountered reading stream.
    • extend

      public FP64 extend(ByteBuffer buffer) throws IOException
      Throws:
      IOException
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getRawFingerprint

      public long getRawFingerprint()
    • toString

      public String toString()
      Overrides:
      toString in class Object