Package org.openhab.core.audio
Class ByteArrayAudioStream
java.lang.Object
java.io.InputStream
org.openhab.core.audio.AudioStream
org.openhab.core.audio.FixedLengthAudioStream
org.openhab.core.audio.ByteArrayAudioStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClonableAudioStream
,SizeableAudioStream
This is an implementation of an
AudioStream
with known length and a clone method, which is based on a simple
byte array.- Author:
- Kai Kreuzer - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Returns a new, fully independent stream instance, which can be read and closed without impacting the original instance.Gets the supported audio formatlong
length()
Provides the length of the stream in bytes.void
mark
(int readlimit) boolean
int
read()
void
reset()
Methods inherited from class org.openhab.core.audio.AudioStream
getId
Methods inherited from class java.io.InputStream
available, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
ByteArrayAudioStream
-
-
Method Details
-
getFormat
Description copied from class:AudioStream
Gets the supported audio format- Specified by:
getFormat
in classAudioStream
- Returns:
- The supported audio format
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
length
public long length()Description copied from interface:SizeableAudioStream
Provides the length of the stream in bytes.- Returns:
- absolute length in bytes
-
getClonedStream
Description copied from interface:ClonableAudioStream
Returns a new, fully independent stream instance, which can be read and closed without impacting the original instance.- Returns:
- a new input stream that can be consumed by the caller
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-