Package org.openhab.core.audio
Class PipedAudioStream.Group
java.lang.Object
java.io.OutputStream
org.openhab.core.audio.PipedAudioStream.Group
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Enclosing class:
- PipedAudioStream
The
PipedAudioStream.Group
is an OutputStream
implementation that can be use to
create one or more PipedAudioStream
instances and write to them at once.
The created PipedAudioStream
instances are removed from the group when closed.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
Creates a newPipedAudioStream
connected to the group.boolean
isEmpty()
Returns true if this group has no streams connected.int
size()
Returns the number of streams connected.void
write
(byte @Nullable [] bytes) void
write
(byte @Nullable [] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
Group
-
-
Method Details
-
getAudioStreamInGroup
Creates a newPipedAudioStream
connected to the group. The stream unregisters itself from the group on close.- Returns:
- a new
PipedAudioStream
to pipe data written to the group - Throws:
IOException
- when unable to create the stream
-
isEmpty
public boolean isEmpty()Returns true if this group has no streams connected.- Returns:
- true if this group has no streams connected
-
size
public int size()Returns the number of streams connected.- Returns:
- the number of streams connected
-
write
public void write(byte @Nullable [] b, int off, int len) - Overrides:
write
in classOutputStream
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte @Nullable [] bytes) - Overrides:
write
in classOutputStream
-
flush
public void flush()- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
-