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 interface AudioDB.Entry

      Entry represents a single audio entry in the database.

      public final class AudioDB.DummyEntry

      DummyEntry is a simple implementation of Entry for holding audio entry data.

      public final class AudioDB.ReaderIterator

      ReaderIterator iterates over entries in the database.

      public final class AudioDB.MatchResult

      MatchResult holds the result of a match operation.

      public class AudioDB.Companion
    • Constructor Summary

      Constructors 
      Constructor Description
      AudioDB()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Iterator<AudioDB.Entry> iterator() Returns an iterator over the entries in the database.
      final Unit add(AudioEntry entry) Adds an audio entry to the database.
      final Boolean removeByName(String name) Removes an entry by name.
      final Boolean replaceByName(String name, AudioEntry entry) Replaces an entry by name.
      final Unit dump(BufferedOutputStream bos, Integer op) Dumps the database to an output stream.
      final Unit dump(BufferedOutputStream bos, Integer op, Boolean skipFooter) Dumps the database to an output stream with an option to skip the footer.
      final Unit load(BufferedInputStream bis) Loads the database from an input stream.
      final Unit loadFromFile(String filePath) Loads the database from a file.
      final Unit loadFromUrl(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.
      • Methods inherited from class kotlin.collections.Iterable

        forEach, spliterator
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AudioDB

        AudioDB()
    • Method Detail

      • 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.