public final class Fingerprint extends Object
Constructor and Description |
---|
Fingerprint()
Initializes this object to the fingerprint of the empty string.
|
Fingerprint(byte[] bytes)
Initializes this object to the fingerprint of the byte
array
bytes , which must be non-null. |
Fingerprint(byte[] bytes,
int start,
int length)
Initializes this object to the fingerprint of the bytes
bytes[start]..bytes[start+length-1] . |
Fingerprint(ByteBuffer buffer)
Initializes this object to the fingerprint of the bytes
in
buffer , which must be non-null. |
Fingerprint(char[] chars)
Initializes this object to the fingerprint of the character
array
chars , which must be non-null. |
Fingerprint(char[] chars,
int start,
int length)
Initializes this object to the fingerprint of the characters
chars[start]..chars[start+length-1] . |
Fingerprint(Fingerprint fp)
Initializes this fingerprint to a copy of
fp ,
which must be non-null. |
Fingerprint(InputStream stream)
Initializes this object to the fingerprint of the bytes
in
stream , which must be non-null. |
Fingerprint(String s)
Initializes this object to the fingerprint of the String
s , which must be non-null. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Fingerprint |
extend(byte b)
Extends this fingerprint by the byte
b . |
Fingerprint |
extend(byte[] bytes)
Extends this fingerprint by the bytes
|
Fingerprint |
extend(byte[] bytes,
int start,
int len)
Extends this fingerprint by the bytes
bytes[offset]..bytes[offset+length-1] . |
Fingerprint |
extend(ByteBuffer buffer) |
Fingerprint |
extend(char c)
Extends this fingerprint by the character
c . |
Fingerprint |
extend(char[] chars)
Extends this fingerprint by the characters
chars[start]..chars[start+length-1] . |
Fingerprint |
extend(char[] chars,
int start,
int len)
Extends this fingerprint by the characters
chars[start]..chars[start+length-1] . |
Fingerprint |
extend(InputStream stream)
Extends this fingerprint by the bytes of the stream
stream , which must be non-null. |
Fingerprint |
extend(int i)
Extends this fingerprint by the integer
i . |
Fingerprint |
extend(long i)
Extends this fingerprint by the integer
i . |
Fingerprint |
extend(String s)
Extends this fingerprint by the characters of the String
s , which must be non-null. |
long |
getRawFingerprint() |
int |
hashCode() |
byte[] |
toBytes()
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.
|
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.
|
String |
toString() |
public Fingerprint()
public Fingerprint(Fingerprint fp)
fp
,
which must be non-null.public Fingerprint(String s)
s
, which must be non-null.public Fingerprint(char[] chars)
chars
, which must be non-null.public Fingerprint(char[] chars, int start, int length)
chars[start]..chars[start+length-1]
.public Fingerprint(byte[] bytes)
bytes
, which must be non-null.public Fingerprint(byte[] bytes, int start, int length)
bytes[start]..bytes[start+length-1]
.public Fingerprint(InputStream stream) throws IOException
stream
, which must be non-null.IOException
- if an error is encountered reading stream
.public Fingerprint(ByteBuffer buffer) throws IOException
buffer
, which must be non-null.IOException
- if an error is encountered reading stream
.public byte[] toBytes()
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.
public byte[] toBytes(byte[] buff)
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.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.public String toHexString()
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.
public Fingerprint extend(String s)
s
, which must be non-null.public Fingerprint extend(char[] chars)
chars[start]..chars[start+length-1]
.public Fingerprint extend(char[] chars, int start, int len)
chars[start]..chars[start+length-1]
.public Fingerprint extend(byte[] bytes, int start, int len)
bytes[offset]..bytes[offset+length-1]
.public Fingerprint extend(byte[] bytes)
public Fingerprint extend(int i)
i
.public Fingerprint extend(long i)
i
.public Fingerprint extend(char c)
c
.public Fingerprint extend(byte b)
b
.public Fingerprint extend(InputStream stream) throws IOException
stream
, which must be non-null.IOException
- if an error is encountered reading stream
.public Fingerprint extend(ByteBuffer buffer) throws IOException
IOException
public long getRawFingerprint()
Copyright © 2024. All rights reserved.