Package com.tagtraum.beatunes.library
Class Fingerprint
- java.lang.Object
-
- com.tagtraum.beatunes.library.Fingerprint
-
public class Fingerprint extends Object
Fingerprint.- Author:
- Hendrik Schreiber
-
-
Field Summary
Fields Modifier and Type Field Description static intCURRENT_VERSION
-
Constructor Summary
Constructors Constructor Description Fingerprint(byte[] bytes)Resource id based fingerprint.Fingerprint(Song song, List<Subprint> subprints)Fingerprint(String resourceId)Resource id based fingerprint.Fingerprint(List<Subprint> subprints)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description floatbitErrorRate(Fingerprint that, int thisAnchor, int thatAnchor)static byte[]fromResourceId(String resourceId)Transforms a resource id into fingerprint (byte array) by first replacing all '_' with '/' and then decoding it using basic Base64 encoding.shortgetMaxSequenceNumber()SonggetSong()SubprintgetSubprint(short sequenceNumber)List<Subprint>getSubprints()intgetVersion()TuneCortex fingerprint version.booleanhasCurrentVersion()Indicates whether this fingerprint is at least of the "current" version.booleanisSparse()voidsetSong(Song song)voidsubsample()static StringtoResourceId(byte[] fingerprint)Transforms a byte array fingerprint into a resources id by first converting it to basic Base64 and then replacing all '/' with '_'.StringtoString()
-
-
-
Field Detail
-
CURRENT_VERSION
public static final int CURRENT_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Fingerprint
public Fingerprint(String resourceId) throws IOException
Resource id based fingerprint.
All underscores
'_'are first replaced with slashes'/', then the resource id is base64 decoded. If the slashes were not 'underscore-escaped' this method still returns a valid fingerprint.- Parameters:
resourceId- a byte array based fingerprint that was first base 64 encoded and then had all slashes replaced with underscores- Throws:
IOException- See Also:
Base64
-
Fingerprint
public Fingerprint(byte[] bytes) throws IOExceptionResource id based fingerprint.
All underscores
'_'are first replaced with slashes'/', then the resource id is base64 decoded. If the slashes were not 'underscore-escaped' this method still returns a valid fingerprint.- Parameters:
bytes- compressed fingerprint- Throws:
IOException
-
-
Method Detail
-
fromResourceId
public static byte[] fromResourceId(String resourceId)
Transforms a resource id into fingerprint (byte array) by first replacing all '_' with '/' and then decoding it using basic Base64 encoding.- Parameters:
resourceId- resource id.- Returns:
- fingerprint in byte array representation
-
toResourceId
public static String toResourceId(byte[] fingerprint)
Transforms a byte array fingerprint into a resources id by first converting it to basic Base64 and then replacing all '/' with '_'.- Parameters:
fingerprint- fingerprint.- Returns:
- resource id, which can be used for server requests
-
isSparse
public boolean isSparse()
-
subsample
public void subsample()
-
hasCurrentVersion
public boolean hasCurrentVersion()
Indicates whether this fingerprint is at least of the "current" version.- Returns:
- true or false
-
getVersion
public int getVersion()
TuneCortex fingerprint version.- Returns:
- version
-
getSong
public Song getSong()
-
setSong
public void setSong(Song song)
-
getSubprint
public Subprint getSubprint(short sequenceNumber)
-
getMaxSequenceNumber
public short getMaxSequenceNumber()
-
bitErrorRate
public float bitErrorRate(Fingerprint that, int thisAnchor, int thatAnchor)
-
-