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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns a new, fully independent stream instance, which can be read and closed without impacting the original instance.Gets the supported audio formatlonglength()Provides the length of the stream in bytes.voidmark(int readlimit) booleanintread()voidreset()Methods inherited from class org.openhab.core.audio.AudioStream
getIdMethods 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:AudioStreamGets the supported audio format- Specified by:
getFormatin classAudioStream- Returns:
- The supported audio format
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
length
public long length()Description copied from interface:SizeableAudioStreamProvides the length of the stream in bytes.- Returns:
- absolute length in bytes
-
getClonedStream
Description copied from interface:ClonableAudioStreamReturns 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:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-