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 int
CURRENT_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 float
bitErrorRate(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.short
getMaxSequenceNumber()
Song
getSong()
Subprint
getSubprint(short sequenceNumber)
List<Subprint>
getSubprints()
int
getVersion()
TuneCortex fingerprint version.boolean
hasCurrentVersion()
Indicates whether this fingerprint is at least of the "current" version.boolean
isSparse()
void
setSong(Song song)
void
subsample()
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 '_'.String
toString()
-
-
-
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 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:
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)
-
-