Class PullAudioInputStreamCallback
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.audio.PullAudioInputStreamCallback
-
public abstract class PullAudioInputStreamCallback extends Object
An abstract base class that defines callback methods (read() and close()) for custom audio input streams).
-
-
Constructor Summary
Constructors Constructor Description PullAudioInputStreamCallback()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()Closes the audio input stream.StringgetProperty(PropertyId id)Get property associated to data buffer, such as a timestamp or userId.abstract intread(byte[] dataBuffer)Reads data from audio input stream into the data buffer.
-
-
-
Method Detail
-
read
public abstract int read(byte[] dataBuffer)
Reads data from audio input stream into the data buffer. The maximal number of bytes to be read is determined by the size of dataBuffer. If there is no data immediately available, read() blocks until the next data becomes available. Note: The dataBuffer returned by read() should not contain any audio header.- Parameters:
dataBuffer- The byte array to store the read data.- Returns:
- The number of bytes filled, or 0 in case the stream hits its end and there is no more data available.
-
getProperty
public String getProperty(PropertyId id)
Get property associated to data buffer, such as a timestamp or userId. If the property is not available, an empty string must be returned. Added in version 1.5.0- Parameters:
id- The Property id.- Returns:
- The String value associated to Property id.
-
close
public abstract void close()
Closes the audio input stream.
-
-