azure-docs-sdk-java/docs-ref-autogen/com.microsoft.cognitiveserv...

202 строки
18 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.cognitiveservices.speech.Connection"
fullName: "com.microsoft.cognitiveservices.speech.Connection"
name: "Connection"
nameWithType: "Connection"
summary: "Connection is a proxy class for managing connection to the speech service of the specified Recognizer."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "<xref href=\"java.lang.Object?alt=java.lang.Object&text=Object\" data-throw-if-not-resolved=\"False\" />"
methodsRef:
- "<xref href=\"java.lang.Object.clone()?alt=java.lang.Object.clone&text=clone\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.equals(java.lang.Object)?alt=java.lang.Object.equals&text=equals\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.finalize()?alt=java.lang.Object.finalize&text=finalize\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.getClass()?alt=java.lang.Object.getClass&text=getClass\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.hashCode()?alt=java.lang.Object.hashCode&text=hashCode\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notify()?alt=java.lang.Object.notify&text=notify\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notifyAll()?alt=java.lang.Object.notifyAll&text=notifyAll\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.toString()?alt=java.lang.Object.toString&text=toString\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait()?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long,int)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
syntax: "public final class **Connection**</br> implements <xref href=\"java.lang.AutoCloseable?alt=java.lang.AutoCloseable&text=AutoCloseable\" data-throw-if-not-resolved=\"False\" />"
fields:
- uid: "com.microsoft.cognitiveservices.speech.Connection.connected"
fullName: "com.microsoft.cognitiveservices.speech.Connection.connected"
name: "connected"
nameWithType: "Connection.connected"
summary: "The Connected event to indicate that the recognizer is connected to service."
modifiers:
- "final"
field:
type: "<xref href=\"com.microsoft.cognitiveservices.speech.util.EventHandlerImpl?alt=com.microsoft.cognitiveservices.speech.util.EventHandlerImpl&text=EventHandlerImpl\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.microsoft.cognitiveservices.speech.ConnectionEventArgs?alt=com.microsoft.cognitiveservices.speech.ConnectionEventArgs&text=ConnectionEventArgs\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public final EventHandlerImpl<ConnectionEventArgs> connected"
desc: "The Connected event to indicate that the recognizer is connected to service. In order to receive the connected event after subscribing to it, the Connection object itself needs to be alive. If the Connection object owning this event is out of its life time, all subscribed events won't be delivered."
- uid: "com.microsoft.cognitiveservices.speech.Connection.disconnected"
fullName: "com.microsoft.cognitiveservices.speech.Connection.disconnected"
name: "disconnected"
nameWithType: "Connection.disconnected"
summary: "The Disconnected event to indicate that the recognizer is disconnected from service."
modifiers:
- "final"
field:
type: "<xref href=\"com.microsoft.cognitiveservices.speech.util.EventHandlerImpl?alt=com.microsoft.cognitiveservices.speech.util.EventHandlerImpl&text=EventHandlerImpl\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.microsoft.cognitiveservices.speech.ConnectionEventArgs?alt=com.microsoft.cognitiveservices.speech.ConnectionEventArgs&text=ConnectionEventArgs\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public final EventHandlerImpl<ConnectionEventArgs> disconnected"
desc: "The Disconnected event to indicate that the recognizer is disconnected from service. In order to receive the disconnected event after subscribing to it, the Connection object itself needs to be alive. If the Connection object owning this event is out of its life time, all subscribed events won't be delivered."
- uid: "com.microsoft.cognitiveservices.speech.Connection.messageReceived"
fullName: "com.microsoft.cognitiveservices.speech.Connection.messageReceived"
name: "messageReceived"
nameWithType: "Connection.messageReceived"
summary: "The Message<wbr>Received event indicates that the service has sent a network message to the client."
modifiers:
- "final"
field:
type: "<xref href=\"com.microsoft.cognitiveservices.speech.util.EventHandlerImpl?alt=com.microsoft.cognitiveservices.speech.util.EventHandlerImpl&text=EventHandlerImpl\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.microsoft.cognitiveservices.speech.ConnectionMessageEventArgs?alt=com.microsoft.cognitiveservices.speech.ConnectionMessageEventArgs&text=ConnectionMessageEventArgs\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public final EventHandlerImpl<ConnectionMessageEventArgs> messageReceived"
desc: "The MessageReceived event indicates that the service has sent a network message to the client. Added in version 1.15.0."
methods:
- uid: "com.microsoft.cognitiveservices.speech.Connection.close()"
fullName: "com.microsoft.cognitiveservices.speech.Connection.close()"
name: "close()"
nameWithType: "Connection.close()"
summary: "Dispose of associated resources."
syntax: "public void close()"
desc: "Dispose of associated resources. close() must be called to relinquish underlying resources correctly."
- uid: "com.microsoft.cognitiveservices.speech.Connection.closeConnection()"
fullName: "com.microsoft.cognitiveservices.speech.Connection.closeConnection()"
name: "closeConnection()"
nameWithType: "Connection.closeConnection()"
summary: "Closes the connection the service."
syntax: "public void closeConnection()"
desc: "Closes the connection the service. Users can optionally call closeConnection() to manually shutdown the connection of the associated Recognizer. The call might fail, depending on the process state of the Recognizer. But the failure does not affect the state of the associated Recognizer."
- uid: "com.microsoft.cognitiveservices.speech.Connection.dispose(boolean)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.dispose(boolean disposing)"
name: "dispose(boolean disposing)"
nameWithType: "Connection.dispose(boolean disposing)"
summary: "This method performs cleanup of resources."
modifiers:
- "protected"
parameters:
- description: "Flag to request disposal."
name: "disposing"
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
syntax: "protected void dispose(boolean disposing)"
desc: "This method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed."
- uid: "com.microsoft.cognitiveservices.speech.Connection.fromConversationTranslator(com.microsoft.cognitiveservices.speech.transcription.ConversationTranslator)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.fromConversationTranslator(ConversationTranslator conversationTranslator)"
name: "fromConversationTranslator(ConversationTranslator conversationTranslator)"
nameWithType: "Connection.fromConversationTranslator(ConversationTranslator conversationTranslator)"
summary: "Gets the Connection instance from the conversation translator."
modifiers:
- "static"
parameters:
- description: "The conversationTranslator associated with the connection."
name: "conversationTranslator"
type: "<xref href=\"com.microsoft.cognitiveservices.speech.transcription.ConversationTranslator?alt=com.microsoft.cognitiveservices.speech.transcription.ConversationTranslator&text=ConversationTranslator\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static Connection fromConversationTranslator(ConversationTranslator conversationTranslator)"
desc: "Gets the Connection instance from the conversation translator."
returns:
description: "The Connection instance of the recognizer."
type: "<xref href=\"com.microsoft.cognitiveservices.speech.Connection?alt=com.microsoft.cognitiveservices.speech.Connection&text=Connection\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.cognitiveservices.speech.Connection.fromDialogServiceConnector(com.microsoft.cognitiveservices.speech.dialog.DialogServiceConnector)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.fromDialogServiceConnector(DialogServiceConnector dialogServiceConnector)"
name: "fromDialogServiceConnector(DialogServiceConnector dialogServiceConnector)"
nameWithType: "Connection.fromDialogServiceConnector(DialogServiceConnector dialogServiceConnector)"
summary: "Gets the Connection instance from the dialog service connector."
modifiers:
- "static"
parameters:
- description: "The dialog service connector associated with the connection, used for observing\n and managing connection state with the speech service."
name: "dialogServiceConnector"
type: "<xref href=\"com.microsoft.cognitiveservices.speech.dialog.DialogServiceConnector?alt=com.microsoft.cognitiveservices.speech.dialog.DialogServiceConnector&text=DialogServiceConnector\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static Connection fromDialogServiceConnector(DialogServiceConnector dialogServiceConnector)"
desc: "Gets the Connection instance from the dialog service connector."
returns:
description: "The Connection instance of the dialog service connector."
type: "<xref href=\"com.microsoft.cognitiveservices.speech.Connection?alt=com.microsoft.cognitiveservices.speech.Connection&text=Connection\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.cognitiveservices.speech.Connection.fromRecognizer(com.microsoft.cognitiveservices.speech.Recognizer)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.fromRecognizer(Recognizer recognizer)"
name: "fromRecognizer(Recognizer recognizer)"
nameWithType: "Connection.fromRecognizer(Recognizer recognizer)"
summary: "Gets the Connection instance from the specified recognizer."
modifiers:
- "static"
parameters:
- description: "The recognizer associated with the connection."
name: "recognizer"
type: "<xref href=\"com.microsoft.cognitiveservices.speech.Recognizer?alt=com.microsoft.cognitiveservices.speech.Recognizer&text=Recognizer\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static Connection fromRecognizer(Recognizer recognizer)"
desc: "Gets the Connection instance from the specified recognizer."
returns:
description: "The Connection instance of the recognizer."
type: "<xref href=\"com.microsoft.cognitiveservices.speech.Connection?alt=com.microsoft.cognitiveservices.speech.Connection&text=Connection\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.cognitiveservices.speech.Connection.fromSpeechSynthesizer(com.microsoft.cognitiveservices.speech.SpeechSynthesizer)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.fromSpeechSynthesizer(SpeechSynthesizer speechSynthesizer)"
name: "fromSpeechSynthesizer(SpeechSynthesizer speechSynthesizer)"
nameWithType: "Connection.fromSpeechSynthesizer(SpeechSynthesizer speechSynthesizer)"
summary: "Gets the Connection instance from the speech synthesizer."
modifiers:
- "static"
parameters:
- description: "The speech synthesizer associated with the connection, used for observing\n and managing connection state with the speech service."
name: "speechSynthesizer"
type: "<xref href=\"com.microsoft.cognitiveservices.speech.SpeechSynthesizer?alt=com.microsoft.cognitiveservices.speech.SpeechSynthesizer&text=SpeechSynthesizer\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static Connection fromSpeechSynthesizer(SpeechSynthesizer speechSynthesizer)"
desc: "Gets the Connection instance from the speech synthesizer. Added in version 1.17.0"
returns:
description: "The Connection instance of the speech synthesizer."
type: "<xref href=\"com.microsoft.cognitiveservices.speech.Connection?alt=com.microsoft.cognitiveservices.speech.Connection&text=Connection\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.cognitiveservices.speech.Connection.openConnection(boolean)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.openConnection(boolean forContinuousRecognition)"
name: "openConnection(boolean forContinuousRecognition)"
nameWithType: "Connection.openConnection(boolean forContinuousRecognition)"
summary: "Starts to set up connection to the service."
parameters:
- description: "indicates whether the connection is used for continuous recognition or single-shot recognition. It takes no effect if the connection is from SpeechSynthsizer."
name: "forContinuousRecognition"
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void openConnection(boolean forContinuousRecognition)"
desc: "Starts to set up connection to the service. Users can optionally call openConnection() to manually set up a connection in advance before starting recognition on the Recognizer associated with this Connection. After starting recognition, calling OpenConnection() might fail, depending on the process state of the Recognizer. But the failure does not affect the state of the associated Recognizer. Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to be notified when the connection is established."
- uid: "com.microsoft.cognitiveservices.speech.Connection.sendMessageAsync(java.lang.String,java.lang.String)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.sendMessageAsync(String path, String payload)"
name: "sendMessageAsync(String path, String payload)"
nameWithType: "Connection.sendMessageAsync(String path, String payload)"
summary: "Sends a message to service."
parameters:
- description: "The message path."
name: "path"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
- description: "The message payload."
name: "payload"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Future<Void> sendMessageAsync(String path, String payload)"
desc: "Sends a message to service. Added in version 1.7.0 Note: This method doesn't work for the connection of SpeechSynthesizer."
returns:
description: "a future representing the asynchronous operation that sends the message."
type: "<xref href=\"java.util.concurrent.Future?alt=java.util.concurrent.Future&text=Future\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"java.lang.Void?alt=java.lang.Void&text=Void\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.microsoft.cognitiveservices.speech.Connection.setMessageProperty(java.lang.String,java.lang.String,java.lang.String)"
fullName: "com.microsoft.cognitiveservices.speech.Connection.setMessageProperty(String path, String propertyName, String propertyValue)"
name: "setMessageProperty(String path, String propertyName, String propertyValue)"
nameWithType: "Connection.setMessageProperty(String path, String propertyName, String propertyValue)"
summary: "Appends a parameter in a message to service."
parameters:
- description: "The message path."
name: "path"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
- description: "The property name that you want to set."
name: "propertyName"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
- description: "The value of the property that you want to set."
name: "propertyValue"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setMessageProperty(String path, String propertyName, String propertyValue)"
desc: "Appends a parameter in a message to service. Added in version 1.7.0 Note: This method doesn't work for the connection of SpeechSynthesizer."
type: "class"
desc: "Connection is a proxy class for managing connection to the speech service of the specified Recognizer. By default, a Recognizer autonomously manages connection to service when needed. The Connection class provides additional methods for users to explicitly open or close a connection and to subscribe to connection status changes. The use of Connection is optional. It is intended for scenarios where fine tuning of application behavior based on connection status is needed. Users can optionally call openConnection() to manually initiate a service connection before starting recognition on the Recognizer associated with this Connection. After starting a recognition, calling openConnection() or closeConnection() might fail. This will not impact the Recognizer or the ongoing recognition. Connection might drop for various reasons, the Recognizer will always try to reinstitute the connection as required to guarantee ongoing operations. In all these cases Connected/Disconnected events will indicate the change of the connection status. Note: close() must be called in order to release underlying resources held by the object. Updated in version 1.17.0."
implements:
- "<xref href=\"java.lang.AutoCloseable?alt=java.lang.AutoCloseable&text=AutoCloseable\" data-throw-if-not-resolved=\"False\" />"
metadata: {}
package: "com.microsoft.cognitiveservices.speech"
artifact: com.microsoft.cognitiveservices.speech:client-sdk:1.24.2