PullAudioInputStreamCallback Class

  • java.lang.Object
    • com.microsoft.cognitiveservices.speech.audio.PullAudioInputStreamCallback

public abstract class PullAudioInputStreamCallback

An abstract base class that defines callback methods (read() and close()) for custom audio input streams).

Constructor Summary

Constructor Description
PullAudioInputStreamCallback()

Method Summary

Modifier and Type Method and Description
abstract void close()

Closes the audio input stream.

java.lang.String getProperty(PropertyId id)

Get property associated to data buffer, such as a timestamp or userId.

abstract int read(byte[] dataBuffer)

Reads data from audio input stream into the data buffer.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

PullAudioInputStreamCallback

public PullAudioInputStreamCallback()

Method Details

close

public abstract void close()

Closes the audio input stream.

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.

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.

Applies to