Class PushAudioInputStream
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.audio.AudioInputStream
-
- com.microsoft.cognitiveservices.speech.audio.PushAudioInputStream
-
- All Implemented Interfaces:
AutoCloseable
public final class PushAudioInputStream extends AudioInputStream
Represents memory backed push audio input stream used for custom audio input configurations. Note: close() must be called in order to release underlying resources held by the object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream.static PushAudioInputStreamcreate()Creates a memory backed PushAudioInputStream using the default format (16 kHz, 16 bit, mono PCM).static PushAudioInputStreamcreate(AudioStreamFormat format)Creates a memory backed PushAudioInputStream with the specified audio format.voidwrite(byte[] dataBuffer)Writes the audio data specified by making an internal copy of the data.-
Methods inherited from class com.microsoft.cognitiveservices.speech.audio.AudioInputStream
createPullStream, createPullStream, createPushStream, createPushStream, getImpl
-
-
-
-
Method Detail
-
create
public static PushAudioInputStream create()
Creates a memory backed PushAudioInputStream using the default format (16 kHz, 16 bit, mono PCM).- Returns:
- The push audio input stream being created.
-
create
public static PushAudioInputStream create(AudioStreamFormat format)
Creates a memory backed PushAudioInputStream with the specified audio format.- Parameters:
format- The audio data format in which audio will be written to the push audio stream's write() method.- Returns:
- The push audio input stream being created.
-
write
public void write(byte[] dataBuffer)
Writes the audio data specified by making an internal copy of the data. Note: The dataBuffer should not contain any audio header.- Parameters:
dataBuffer- The audio buffer of which this function will make a copy.
-
close
public void close()
Closes the stream. Note: close() must be called in order to release underlying resources held by the object.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAudioInputStream
-
-