ConnectionMessage Class

  • java.lang.Object
    • com.microsoft.cognitiveservices.speech.ConnectionMessage

Implements

java.lang.AutoCloseable

public final class ConnectionMessage
implements java.lang.AutoCloseable

ConnectionMessage represents implementation specific messages sent to and received from the speech service. These messages are provided for debugging purposes and should not be used for production use cases with the Azure Cognitive Services Speech Service. Messages sent to and received from the Speech Service are subject to change without notice. This includes message contents, headers, payloads, ordering, etc. Note: close() must be called in order to release underlying resources held by the object. Added in version 1.15.0.

Method Summary

Modifier and Type Method and Description
void close()

Explicitly frees any external resource attached to the object.

byte[] getBinaryMessage()

Gets the binary message payload.

java.lang.String getPath()

The message Path

PropertyCollection getProperties()

A collection of properties and their values defined for this ConnectionMessage.

java.lang.String getTextMessage()

Gets the text message payload.

boolean isBinaryMessage()

Checks to see if the ConnectionMessage is a binary message.

boolean isTextMessage()

Checks to see if the ConnectionMessage is a text message.

java.lang.String toString()

Returns a string that represents the connection message.

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

Method Details

close

public void close()

Explicitly frees any external resource attached to the object. Note: close() must be called in order to release underlying resources held by the object.

getBinaryMessage

public byte[] getBinaryMessage()

Gets the binary message payload.

Returns:

An array of bytes containing the binary message.

getPath

public String getPath()

The message Path

Returns:

A string that specifies the message type.

getProperties

public PropertyCollection getProperties()

A collection of properties and their values defined for this ConnectionMessage. Message headers can be accessed via this collection (e.g. "Content-Type").

Returns:

PropertyCollection

getTextMessage

public String getTextMessage()

Gets the text message payload. Typically the text message content-type is application/json. To determine other content-types use Properties.GetProperty("Content-Type").

Returns:

A string containing the text message.

isBinaryMessage

public boolean isBinaryMessage()

Checks to see if the ConnectionMessage is a binary message. See also GetBinaryMessage().

Returns:

A boolean indicated if the message payload is binary.

isTextMessage

public boolean isTextMessage()

Checks to see if the ConnectionMessage is a text message. See also IsBinaryMessage().

Returns:

A bool indicated if the message payload is text.

toString

public String toString()

Returns a string that represents the connection message.

Overrides:

ConnectionMessage.toString()

Returns:

A string that represents the connection message.

Applies to