Class AudioDB
-
- All Implemented Interfaces:
-
kotlin.collections.Iterable
public final class AudioDB implements Iterable<AudioDB.Entry>
AudioDB is a database for storing and managing audio entries. Provides methods for adding, removing, replacing, iterating, and matching audio entries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceAudioDB.EntryEntry represents a single audio entry in the database.
public final classAudioDB.DummyEntryDummyEntry is a simple implementation of Entry for holding audio entry data.
public final classAudioDB.ReaderIteratorReaderIterator iterates over entries in the database.
public final classAudioDB.MatchResultMatchResult holds the result of a match operation.
public classAudioDB.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerAFP_TYPE_LIVESTREAMpublic final static IntegerAFP_TYPE_ARCHIVE_CFpublic final static IntegerAFP_TYPE_ARCHIVE_PGpublic final static IntegerAPACK_OP_TEST_MATCHpublic final static IntegerAPACK_OP_ADDpublic final static IntegerAPACK_OP_DEL_IF_ANYpublic final static AudioDB.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description AudioDB()
-
Method Summary
Modifier and Type Method Description Iterator<AudioDB.Entry>iterator()Returns an iterator over the entries in the database. final Unitadd(AudioEntry entry)Adds an audio entry to the database. final BooleanremoveByName(String name)Removes an entry by name. final BooleanreplaceByName(String name, AudioEntry entry)Replaces an entry by name. final Unitdump(BufferedOutputStream bos, Integer op)Dumps the database to an output stream. final Unitdump(BufferedOutputStream bos, Integer op, Boolean skipFooter)Dumps the database to an output stream with an option to skip the footer. final Unitload(BufferedInputStream bis)Loads the database from an input stream. final UnitloadFromFile(String filePath)Loads the database from a file. final UnitloadFromUrl(String uri)Loads the database from a URL. final Array<AudioDB.MatchResult>match(ByteArray hash, Integer pos, Integer len, Integer nresults)Matches an audio hash against the database. -
-
Method Detail
-
iterator
Iterator<AudioDB.Entry> iterator()
Returns an iterator over the entries in the database.
-
add
final Unit add(AudioEntry entry)
Adds an audio entry to the database.
- Parameters:
entry- The entry to add.
-
removeByName
final Boolean removeByName(String name)
Removes an entry by name.
- Parameters:
name- The name of the entry to remove.- Returns:
true if successful, false otherwise.
-
replaceByName
final Boolean replaceByName(String name, AudioEntry entry)
Replaces an entry by name.
- Parameters:
name- The name of the entry to replace.entry- The new entry.- Returns:
true if successful, false otherwise.
-
dump
final Unit dump(BufferedOutputStream bos, Integer op)
Dumps the database to an output stream.
- Parameters:
bos- The output stream.op- The operation code.
-
dump
final Unit dump(BufferedOutputStream bos, Integer op, Boolean skipFooter)
Dumps the database to an output stream with an option to skip the footer.
- Parameters:
bos- The output stream.op- The operation code.skipFooter- Whether to skip the footer.
-
load
final Unit load(BufferedInputStream bis)
Loads the database from an input stream.
- Parameters:
bis- The input stream.
-
loadFromFile
final Unit loadFromFile(String filePath)
Loads the database from a file.
- Parameters:
filePath- The path to the file.
-
loadFromUrl
final Unit loadFromUrl(String uri)
Loads the database from a URL.
-
match
final Array<AudioDB.MatchResult> match(ByteArray hash, Integer pos, Integer len, Integer nresults)
Matches an audio hash against the database.
- Parameters:
hash- The audio hash.pos- The position in the hash.len- The length of the hash.nresults- The number of results to return.- Returns:
An array of match results.
-
-
-
-