Class AudioStream

java.lang.Object
java.io.InputStream
org.openhab.core.audio.AudioStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
ByteArrayAudioStream, FileAudioStream, FixedLengthAudioStream, PipedAudioStream, URLAudioStream

@NonNullByDefault public abstract class AudioStream extends InputStream
Wrapper for a source of audio data.

In contrast to AudioSource, this is often a "one time use" instance for passing some audio data, but it is not meant to be registered as a service.

The stream needs to be closed by the client that uses it.

Author:
Harald Kuhn - Initial contribution, Kelly Davis - Modified to match discussion in #584, Kai Kreuzer - Refactored to be only a temporary instance for the stream
  • Constructor Details

    • AudioStream

      public AudioStream()
  • Method Details

    • getFormat

      public abstract AudioFormat getFormat()
      Gets the supported audio format
      Returns:
      The supported audio format
    • getId

      public @Nullable String getId()
      Useful for sinks playing the same stream multiple times to avoid already done computation (like re-encoding).
      Returns:
      A string uniquely identifying the stream.