All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.speech.v1.StreamingRecognizeResponse Maven / Gradle / Ivy

There is a newer version: 4.44.0
Show newest version
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/speech/v1/cloud_speech.proto

package com.google.cloud.speech.v1;

/**
 * 
 * `StreamingRecognizeResponse` is the only message returned to the client by
 * `StreamingRecognize`. A series of one or more `StreamingRecognizeResponse`
 * messages are streamed back to the client.
 * Here's an example of a series of ten `StreamingRecognizeResponse`s that might
 * be returned while processing audio:
 * 1. results { alternatives { transcript: "tube" } stability: 0.01 }
 * 2. results { alternatives { transcript: "to be a" } stability: 0.01 }
 * 3. results { alternatives { transcript: "to be" } stability: 0.9 }
 *    results { alternatives { transcript: " or not to be" } stability: 0.01 }
 * 4. results { alternatives { transcript: "to be or not to be"
 *                             confidence: 0.92 }
 *              alternatives { transcript: "to bee or not to bee" }
 *              is_final: true }
 * 5. results { alternatives { transcript: " that's" } stability: 0.01 }
 * 6. results { alternatives { transcript: " that is" } stability: 0.9 }
 *    results { alternatives { transcript: " the question" } stability: 0.01 }
 * 7. speech_event_type: END_OF_SINGLE_UTTERANCE
 * 8. results { alternatives { transcript: " that is the question"
 *                             confidence: 0.98 }
 *              alternatives { transcript: " that was the question" }
 *              is_final: true }
 * Notes:
 * - Only two of the above responses #4 and #8 contain final results; they are
 *   indicated by `is_final: true`. Concatenating these together generates the
 *   full transcript: "to be or not to be that is the question".
 * - The others contain interim `results`. #3 and #6 contain two interim
 *   `results`: the first portion has a high stability and is less likely to
 *   change; the second portion has a low stability and is very likely to
 *   change. A UI designer might choose to show only high stability `results`.
 * - The specific `stability` and `confidence` values shown above are only for
 *   illustrative purposes. Actual values may vary.
 * - In each response, only one of these fields will be set:
 *     `error`,
 *     `speech_event_type`, or
 *     one or more (repeated) `results`.
 * 
* * Protobuf type {@code google.cloud.speech.v1.StreamingRecognizeResponse} */ public final class StreamingRecognizeResponse extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.speech.v1.StreamingRecognizeResponse) StreamingRecognizeResponseOrBuilder { // Use StreamingRecognizeResponse.newBuilder() to construct. private StreamingRecognizeResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } private StreamingRecognizeResponse() { results_ = java.util.Collections.emptyList(); speechEventType_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private StreamingRecognizeResponse( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { com.google.rpc.Status.Builder subBuilder = null; if (error_ != null) { subBuilder = error_.toBuilder(); } error_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(error_); error_ = subBuilder.buildPartial(); } break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { results_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } results_.add( input.readMessage(com.google.cloud.speech.v1.StreamingRecognitionResult.parser(), extensionRegistry)); break; } case 32: { int rawValue = input.readEnum(); speechEventType_ = rawValue; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { results_ = java.util.Collections.unmodifiableList(results_); } makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.speech.v1.SpeechProto.internal_static_google_cloud_speech_v1_StreamingRecognizeResponse_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.speech.v1.SpeechProto.internal_static_google_cloud_speech_v1_StreamingRecognizeResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.speech.v1.StreamingRecognizeResponse.class, com.google.cloud.speech.v1.StreamingRecognizeResponse.Builder.class); } /** *
   * Indicates the type of speech event.
   * 
* * Protobuf enum {@code google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType} */ public enum SpeechEventType implements com.google.protobuf.ProtocolMessageEnum { /** *
     * No speech event specified.
     * 
* * SPEECH_EVENT_UNSPECIFIED = 0; */ SPEECH_EVENT_UNSPECIFIED(0), /** *
     * This event indicates that the server has detected the end of the user's
     * speech utterance and expects no additional speech. Therefore, the server
     * will not process additional audio (although it may subsequently return
     * additional results). The client should stop sending additional audio
     * data, half-close the gRPC connection, and wait for any additional results
     * until the server closes the gRPC connection. This event is only sent if
     * `single_utterance` was set to `true`, and is not used otherwise.
     * 
* * END_OF_SINGLE_UTTERANCE = 1; */ END_OF_SINGLE_UTTERANCE(1), UNRECOGNIZED(-1), ; /** *
     * No speech event specified.
     * 
* * SPEECH_EVENT_UNSPECIFIED = 0; */ public static final int SPEECH_EVENT_UNSPECIFIED_VALUE = 0; /** *
     * This event indicates that the server has detected the end of the user's
     * speech utterance and expects no additional speech. Therefore, the server
     * will not process additional audio (although it may subsequently return
     * additional results). The client should stop sending additional audio
     * data, half-close the gRPC connection, and wait for any additional results
     * until the server closes the gRPC connection. This event is only sent if
     * `single_utterance` was set to `true`, and is not used otherwise.
     * 
* * END_OF_SINGLE_UTTERANCE = 1; */ public static final int END_OF_SINGLE_UTTERANCE_VALUE = 1; public final int getNumber() { if (this == UNRECOGNIZED) { throw new java.lang.IllegalArgumentException( "Can't get the number of an unknown enum value."); } return value; } /** * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static SpeechEventType valueOf(int value) { return forNumber(value); } public static SpeechEventType forNumber(int value) { switch (value) { case 0: return SPEECH_EVENT_UNSPECIFIED; case 1: return END_OF_SINGLE_UTTERANCE; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< SpeechEventType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public SpeechEventType findValueByNumber(int number) { return SpeechEventType.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.google.cloud.speech.v1.StreamingRecognizeResponse.getDescriptor().getEnumTypes().get(0); } private static final SpeechEventType[] VALUES = values(); public static SpeechEventType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } if (desc.getIndex() == -1) { return UNRECOGNIZED; } return VALUES[desc.getIndex()]; } private final int value; private SpeechEventType(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType) } private int bitField0_; public static final int ERROR_FIELD_NUMBER = 1; private com.google.rpc.Status error_; /** *
   * *Output-only* If set, returns a [google.rpc.Status][] message that
   * specifies the error for the operation.
   * 
* * optional .google.rpc.Status error = 1; */ public boolean hasError() { return error_ != null; } /** *
   * *Output-only* If set, returns a [google.rpc.Status][] message that
   * specifies the error for the operation.
   * 
* * optional .google.rpc.Status error = 1; */ public com.google.rpc.Status getError() { return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; } /** *
   * *Output-only* If set, returns a [google.rpc.Status][] message that
   * specifies the error for the operation.
   * 
* * optional .google.rpc.Status error = 1; */ public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { return getError(); } public static final int RESULTS_FIELD_NUMBER = 2; private java.util.List results_; /** *
   * *Output-only* This repeated list contains zero or more results that
   * correspond to consecutive portions of the audio currently being processed.
   * It contains zero or one `is_final=true` result (the newly settled portion),
   * followed by zero or more `is_final=false` results.
   * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public java.util.List getResultsList() { return results_; } /** *
   * *Output-only* This repeated list contains zero or more results that
   * correspond to consecutive portions of the audio currently being processed.
   * It contains zero or one `is_final=true` result (the newly settled portion),
   * followed by zero or more `is_final=false` results.
   * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public java.util.List getResultsOrBuilderList() { return results_; } /** *
   * *Output-only* This repeated list contains zero or more results that
   * correspond to consecutive portions of the audio currently being processed.
   * It contains zero or one `is_final=true` result (the newly settled portion),
   * followed by zero or more `is_final=false` results.
   * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public int getResultsCount() { return results_.size(); } /** *
   * *Output-only* This repeated list contains zero or more results that
   * correspond to consecutive portions of the audio currently being processed.
   * It contains zero or one `is_final=true` result (the newly settled portion),
   * followed by zero or more `is_final=false` results.
   * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResult getResults(int index) { return results_.get(index); } /** *
   * *Output-only* This repeated list contains zero or more results that
   * correspond to consecutive portions of the audio currently being processed.
   * It contains zero or one `is_final=true` result (the newly settled portion),
   * followed by zero or more `is_final=false` results.
   * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResultOrBuilder getResultsOrBuilder( int index) { return results_.get(index); } public static final int SPEECH_EVENT_TYPE_FIELD_NUMBER = 4; private int speechEventType_; /** *
   * *Output-only* Indicates the type of speech event.
   * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public int getSpeechEventTypeValue() { return speechEventType_; } /** *
   * *Output-only* Indicates the type of speech event.
   * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType getSpeechEventType() { com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType result = com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.valueOf(speechEventType_); return result == null ? com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.UNRECOGNIZED : result; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (error_ != null) { output.writeMessage(1, getError()); } for (int i = 0; i < results_.size(); i++) { output.writeMessage(2, results_.get(i)); } if (speechEventType_ != com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.SPEECH_EVENT_UNSPECIFIED.getNumber()) { output.writeEnum(4, speechEventType_); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (error_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getError()); } for (int i = 0; i < results_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, results_.get(i)); } if (speechEventType_ != com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.SPEECH_EVENT_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(4, speechEventType_); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.speech.v1.StreamingRecognizeResponse)) { return super.equals(obj); } com.google.cloud.speech.v1.StreamingRecognizeResponse other = (com.google.cloud.speech.v1.StreamingRecognizeResponse) obj; boolean result = true; result = result && (hasError() == other.hasError()); if (hasError()) { result = result && getError() .equals(other.getError()); } result = result && getResultsList() .equals(other.getResultsList()); result = result && speechEventType_ == other.speechEventType_; return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasError()) { hash = (37 * hash) + ERROR_FIELD_NUMBER; hash = (53 * hash) + getError().hashCode(); } if (getResultsCount() > 0) { hash = (37 * hash) + RESULTS_FIELD_NUMBER; hash = (53 * hash) + getResultsList().hashCode(); } hash = (37 * hash) + SPEECH_EVENT_TYPE_FIELD_NUMBER; hash = (53 * hash) + speechEventType_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.speech.v1.StreamingRecognizeResponse prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** *
   * `StreamingRecognizeResponse` is the only message returned to the client by
   * `StreamingRecognize`. A series of one or more `StreamingRecognizeResponse`
   * messages are streamed back to the client.
   * Here's an example of a series of ten `StreamingRecognizeResponse`s that might
   * be returned while processing audio:
   * 1. results { alternatives { transcript: "tube" } stability: 0.01 }
   * 2. results { alternatives { transcript: "to be a" } stability: 0.01 }
   * 3. results { alternatives { transcript: "to be" } stability: 0.9 }
   *    results { alternatives { transcript: " or not to be" } stability: 0.01 }
   * 4. results { alternatives { transcript: "to be or not to be"
   *                             confidence: 0.92 }
   *              alternatives { transcript: "to bee or not to bee" }
   *              is_final: true }
   * 5. results { alternatives { transcript: " that's" } stability: 0.01 }
   * 6. results { alternatives { transcript: " that is" } stability: 0.9 }
   *    results { alternatives { transcript: " the question" } stability: 0.01 }
   * 7. speech_event_type: END_OF_SINGLE_UTTERANCE
   * 8. results { alternatives { transcript: " that is the question"
   *                             confidence: 0.98 }
   *              alternatives { transcript: " that was the question" }
   *              is_final: true }
   * Notes:
   * - Only two of the above responses #4 and #8 contain final results; they are
   *   indicated by `is_final: true`. Concatenating these together generates the
   *   full transcript: "to be or not to be that is the question".
   * - The others contain interim `results`. #3 and #6 contain two interim
   *   `results`: the first portion has a high stability and is less likely to
   *   change; the second portion has a low stability and is very likely to
   *   change. A UI designer might choose to show only high stability `results`.
   * - The specific `stability` and `confidence` values shown above are only for
   *   illustrative purposes. Actual values may vary.
   * - In each response, only one of these fields will be set:
   *     `error`,
   *     `speech_event_type`, or
   *     one or more (repeated) `results`.
   * 
* * Protobuf type {@code google.cloud.speech.v1.StreamingRecognizeResponse} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:google.cloud.speech.v1.StreamingRecognizeResponse) com.google.cloud.speech.v1.StreamingRecognizeResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.speech.v1.SpeechProto.internal_static_google_cloud_speech_v1_StreamingRecognizeResponse_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.speech.v1.SpeechProto.internal_static_google_cloud_speech_v1_StreamingRecognizeResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.speech.v1.StreamingRecognizeResponse.class, com.google.cloud.speech.v1.StreamingRecognizeResponse.Builder.class); } // Construct using com.google.cloud.speech.v1.StreamingRecognizeResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getResultsFieldBuilder(); } } public Builder clear() { super.clear(); if (errorBuilder_ == null) { error_ = null; } else { error_ = null; errorBuilder_ = null; } if (resultsBuilder_ == null) { results_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { resultsBuilder_.clear(); } speechEventType_ = 0; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.speech.v1.SpeechProto.internal_static_google_cloud_speech_v1_StreamingRecognizeResponse_descriptor; } public com.google.cloud.speech.v1.StreamingRecognizeResponse getDefaultInstanceForType() { return com.google.cloud.speech.v1.StreamingRecognizeResponse.getDefaultInstance(); } public com.google.cloud.speech.v1.StreamingRecognizeResponse build() { com.google.cloud.speech.v1.StreamingRecognizeResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public com.google.cloud.speech.v1.StreamingRecognizeResponse buildPartial() { com.google.cloud.speech.v1.StreamingRecognizeResponse result = new com.google.cloud.speech.v1.StreamingRecognizeResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (errorBuilder_ == null) { result.error_ = error_; } else { result.error_ = errorBuilder_.build(); } if (resultsBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { results_ = java.util.Collections.unmodifiableList(results_); bitField0_ = (bitField0_ & ~0x00000002); } result.results_ = results_; } else { result.results_ = resultsBuilder_.build(); } result.speechEventType_ = speechEventType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.speech.v1.StreamingRecognizeResponse) { return mergeFrom((com.google.cloud.speech.v1.StreamingRecognizeResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.speech.v1.StreamingRecognizeResponse other) { if (other == com.google.cloud.speech.v1.StreamingRecognizeResponse.getDefaultInstance()) return this; if (other.hasError()) { mergeError(other.getError()); } if (resultsBuilder_ == null) { if (!other.results_.isEmpty()) { if (results_.isEmpty()) { results_ = other.results_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureResultsIsMutable(); results_.addAll(other.results_); } onChanged(); } } else { if (!other.results_.isEmpty()) { if (resultsBuilder_.isEmpty()) { resultsBuilder_.dispose(); resultsBuilder_ = null; results_ = other.results_; bitField0_ = (bitField0_ & ~0x00000002); resultsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getResultsFieldBuilder() : null; } else { resultsBuilder_.addAllMessages(other.results_); } } } if (other.speechEventType_ != 0) { setSpeechEventTypeValue(other.getSpeechEventTypeValue()); } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.speech.v1.StreamingRecognizeResponse parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.speech.v1.StreamingRecognizeResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.rpc.Status error_ = null; private com.google.protobuf.SingleFieldBuilderV3< com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> errorBuilder_; /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public boolean hasError() { return errorBuilder_ != null || error_ != null; } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public com.google.rpc.Status getError() { if (errorBuilder_ == null) { return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; } else { return errorBuilder_.getMessage(); } } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public Builder setError(com.google.rpc.Status value) { if (errorBuilder_ == null) { if (value == null) { throw new NullPointerException(); } error_ = value; onChanged(); } else { errorBuilder_.setMessage(value); } return this; } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public Builder setError( com.google.rpc.Status.Builder builderForValue) { if (errorBuilder_ == null) { error_ = builderForValue.build(); onChanged(); } else { errorBuilder_.setMessage(builderForValue.build()); } return this; } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public Builder mergeError(com.google.rpc.Status value) { if (errorBuilder_ == null) { if (error_ != null) { error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial(); } else { error_ = value; } onChanged(); } else { errorBuilder_.mergeFrom(value); } return this; } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public Builder clearError() { if (errorBuilder_ == null) { error_ = null; onChanged(); } else { error_ = null; errorBuilder_ = null; } return this; } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public com.google.rpc.Status.Builder getErrorBuilder() { onChanged(); return getErrorFieldBuilder().getBuilder(); } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { if (errorBuilder_ != null) { return errorBuilder_.getMessageOrBuilder(); } else { return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; } } /** *
     * *Output-only* If set, returns a [google.rpc.Status][] message that
     * specifies the error for the operation.
     * 
* * optional .google.rpc.Status error = 1; */ private com.google.protobuf.SingleFieldBuilderV3< com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> getErrorFieldBuilder() { if (errorBuilder_ == null) { errorBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>( getError(), getParentForChildren(), isClean()); error_ = null; } return errorBuilder_; } private java.util.List results_ = java.util.Collections.emptyList(); private void ensureResultsIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { results_ = new java.util.ArrayList(results_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.speech.v1.StreamingRecognitionResult, com.google.cloud.speech.v1.StreamingRecognitionResult.Builder, com.google.cloud.speech.v1.StreamingRecognitionResultOrBuilder> resultsBuilder_; /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public java.util.List getResultsList() { if (resultsBuilder_ == null) { return java.util.Collections.unmodifiableList(results_); } else { return resultsBuilder_.getMessageList(); } } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public int getResultsCount() { if (resultsBuilder_ == null) { return results_.size(); } else { return resultsBuilder_.getCount(); } } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResult getResults(int index) { if (resultsBuilder_ == null) { return results_.get(index); } else { return resultsBuilder_.getMessage(index); } } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder setResults( int index, com.google.cloud.speech.v1.StreamingRecognitionResult value) { if (resultsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultsIsMutable(); results_.set(index, value); onChanged(); } else { resultsBuilder_.setMessage(index, value); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder setResults( int index, com.google.cloud.speech.v1.StreamingRecognitionResult.Builder builderForValue) { if (resultsBuilder_ == null) { ensureResultsIsMutable(); results_.set(index, builderForValue.build()); onChanged(); } else { resultsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder addResults(com.google.cloud.speech.v1.StreamingRecognitionResult value) { if (resultsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultsIsMutable(); results_.add(value); onChanged(); } else { resultsBuilder_.addMessage(value); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder addResults( int index, com.google.cloud.speech.v1.StreamingRecognitionResult value) { if (resultsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultsIsMutable(); results_.add(index, value); onChanged(); } else { resultsBuilder_.addMessage(index, value); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder addResults( com.google.cloud.speech.v1.StreamingRecognitionResult.Builder builderForValue) { if (resultsBuilder_ == null) { ensureResultsIsMutable(); results_.add(builderForValue.build()); onChanged(); } else { resultsBuilder_.addMessage(builderForValue.build()); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder addResults( int index, com.google.cloud.speech.v1.StreamingRecognitionResult.Builder builderForValue) { if (resultsBuilder_ == null) { ensureResultsIsMutable(); results_.add(index, builderForValue.build()); onChanged(); } else { resultsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder addAllResults( java.lang.Iterable values) { if (resultsBuilder_ == null) { ensureResultsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, results_); onChanged(); } else { resultsBuilder_.addAllMessages(values); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder clearResults() { if (resultsBuilder_ == null) { results_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { resultsBuilder_.clear(); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public Builder removeResults(int index) { if (resultsBuilder_ == null) { ensureResultsIsMutable(); results_.remove(index); onChanged(); } else { resultsBuilder_.remove(index); } return this; } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResult.Builder getResultsBuilder( int index) { return getResultsFieldBuilder().getBuilder(index); } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResultOrBuilder getResultsOrBuilder( int index) { if (resultsBuilder_ == null) { return results_.get(index); } else { return resultsBuilder_.getMessageOrBuilder(index); } } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public java.util.List getResultsOrBuilderList() { if (resultsBuilder_ != null) { return resultsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(results_); } } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResult.Builder addResultsBuilder() { return getResultsFieldBuilder().addBuilder( com.google.cloud.speech.v1.StreamingRecognitionResult.getDefaultInstance()); } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public com.google.cloud.speech.v1.StreamingRecognitionResult.Builder addResultsBuilder( int index) { return getResultsFieldBuilder().addBuilder( index, com.google.cloud.speech.v1.StreamingRecognitionResult.getDefaultInstance()); } /** *
     * *Output-only* This repeated list contains zero or more results that
     * correspond to consecutive portions of the audio currently being processed.
     * It contains zero or one `is_final=true` result (the newly settled portion),
     * followed by zero or more `is_final=false` results.
     * 
* * repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2; */ public java.util.List getResultsBuilderList() { return getResultsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.speech.v1.StreamingRecognitionResult, com.google.cloud.speech.v1.StreamingRecognitionResult.Builder, com.google.cloud.speech.v1.StreamingRecognitionResultOrBuilder> getResultsFieldBuilder() { if (resultsBuilder_ == null) { resultsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.speech.v1.StreamingRecognitionResult, com.google.cloud.speech.v1.StreamingRecognitionResult.Builder, com.google.cloud.speech.v1.StreamingRecognitionResultOrBuilder>( results_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); results_ = null; } return resultsBuilder_; } private int speechEventType_ = 0; /** *
     * *Output-only* Indicates the type of speech event.
     * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public int getSpeechEventTypeValue() { return speechEventType_; } /** *
     * *Output-only* Indicates the type of speech event.
     * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public Builder setSpeechEventTypeValue(int value) { speechEventType_ = value; onChanged(); return this; } /** *
     * *Output-only* Indicates the type of speech event.
     * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType getSpeechEventType() { com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType result = com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.valueOf(speechEventType_); return result == null ? com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType.UNRECOGNIZED : result; } /** *
     * *Output-only* Indicates the type of speech event.
     * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public Builder setSpeechEventType(com.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType value) { if (value == null) { throw new NullPointerException(); } speechEventType_ = value.getNumber(); onChanged(); return this; } /** *
     * *Output-only* Indicates the type of speech event.
     * 
* * optional .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4; */ public Builder clearSpeechEventType() { speechEventType_ = 0; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:google.cloud.speech.v1.StreamingRecognizeResponse) } // @@protoc_insertion_point(class_scope:google.cloud.speech.v1.StreamingRecognizeResponse) private static final com.google.cloud.speech.v1.StreamingRecognizeResponse DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.speech.v1.StreamingRecognizeResponse(); } public static com.google.cloud.speech.v1.StreamingRecognizeResponse getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public StreamingRecognizeResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new StreamingRecognizeResponse(input, extensionRegistry); } }; public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } public com.google.cloud.speech.v1.StreamingRecognizeResponse getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy