Class AudioSinkUtilsImpl

java.lang.Object
org.openhab.core.audio.utils.AudioSinkUtilsImpl
All Implemented Interfaces:
AudioSinkUtils

@NonNullByDefault public class AudioSinkUtilsImpl extends Object implements AudioSinkUtils
Some utility methods for sink
Author:
Gwendal Roulleau - Initial contribution
  • Constructor Details

    • AudioSinkUtilsImpl

      public AudioSinkUtilsImpl()
  • Method Details

    • transferAndAnalyzeLength

      public @Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) throws IOException
      Description copied from interface: AudioSinkUtils
      Transfers data from an input stream to an output stream and computes on the fly its duration
      Specified by:
      transferAndAnalyzeLength in interface AudioSinkUtils
      Parameters:
      in - the input stream giving audio data ta play
      out - the output stream receiving data to play
      Returns:
      the timestamp (from System.nanoTime) when the sound should be fully played. Returns null if computing time fails.
      Throws:
      IOException - if reading from the stream or writing to the stream failed