• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/speech/v1/cloud_speech.proto
18 
19 package com.google.cloud.speech.v1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * Contains audio data in the encoding specified in the `RecognitionConfig`.
26  * Either `content` or `uri` must be supplied. Supplying both or neither
27  * returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
28  * See [content limits](https://cloud.google.com/speech-to-text/quotas#content).
29  * </pre>
30  *
31  * Protobuf type {@code google.cloud.speech.v1.RecognitionAudio}
32  */
33 public final class RecognitionAudio extends com.google.protobuf.GeneratedMessageV3
34     implements
35     // @@protoc_insertion_point(message_implements:google.cloud.speech.v1.RecognitionAudio)
36     RecognitionAudioOrBuilder {
37   private static final long serialVersionUID = 0L;
38   // Use RecognitionAudio.newBuilder() to construct.
RecognitionAudio(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)39   private RecognitionAudio(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
40     super(builder);
41   }
42 
RecognitionAudio()43   private RecognitionAudio() {}
44 
45   @java.lang.Override
46   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)47   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
48     return new RecognitionAudio();
49   }
50 
51   @java.lang.Override
getUnknownFields()52   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
53     return this.unknownFields;
54   }
55 
getDescriptor()56   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
57     return com.google.cloud.speech.v1.SpeechProto
58         .internal_static_google_cloud_speech_v1_RecognitionAudio_descriptor;
59   }
60 
61   @java.lang.Override
62   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()63       internalGetFieldAccessorTable() {
64     return com.google.cloud.speech.v1.SpeechProto
65         .internal_static_google_cloud_speech_v1_RecognitionAudio_fieldAccessorTable
66         .ensureFieldAccessorsInitialized(
67             com.google.cloud.speech.v1.RecognitionAudio.class,
68             com.google.cloud.speech.v1.RecognitionAudio.Builder.class);
69   }
70 
71   private int audioSourceCase_ = 0;
72   private java.lang.Object audioSource_;
73 
74   public enum AudioSourceCase
75       implements
76           com.google.protobuf.Internal.EnumLite,
77           com.google.protobuf.AbstractMessage.InternalOneOfEnum {
78     CONTENT(1),
79     URI(2),
80     AUDIOSOURCE_NOT_SET(0);
81     private final int value;
82 
AudioSourceCase(int value)83     private AudioSourceCase(int value) {
84       this.value = value;
85     }
86     /**
87      * @param value The number of the enum to look for.
88      * @return The enum associated with the given number.
89      * @deprecated Use {@link #forNumber(int)} instead.
90      */
91     @java.lang.Deprecated
valueOf(int value)92     public static AudioSourceCase valueOf(int value) {
93       return forNumber(value);
94     }
95 
forNumber(int value)96     public static AudioSourceCase forNumber(int value) {
97       switch (value) {
98         case 1:
99           return CONTENT;
100         case 2:
101           return URI;
102         case 0:
103           return AUDIOSOURCE_NOT_SET;
104         default:
105           return null;
106       }
107     }
108 
getNumber()109     public int getNumber() {
110       return this.value;
111     }
112   };
113 
getAudioSourceCase()114   public AudioSourceCase getAudioSourceCase() {
115     return AudioSourceCase.forNumber(audioSourceCase_);
116   }
117 
118   public static final int CONTENT_FIELD_NUMBER = 1;
119   /**
120    *
121    *
122    * <pre>
123    * The audio data bytes encoded as specified in
124    * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
125    * pure binary representation, whereas JSON representations use base64.
126    * </pre>
127    *
128    * <code>bytes content = 1;</code>
129    *
130    * @return Whether the content field is set.
131    */
132   @java.lang.Override
hasContent()133   public boolean hasContent() {
134     return audioSourceCase_ == 1;
135   }
136   /**
137    *
138    *
139    * <pre>
140    * The audio data bytes encoded as specified in
141    * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
142    * pure binary representation, whereas JSON representations use base64.
143    * </pre>
144    *
145    * <code>bytes content = 1;</code>
146    *
147    * @return The content.
148    */
149   @java.lang.Override
getContent()150   public com.google.protobuf.ByteString getContent() {
151     if (audioSourceCase_ == 1) {
152       return (com.google.protobuf.ByteString) audioSource_;
153     }
154     return com.google.protobuf.ByteString.EMPTY;
155   }
156 
157   public static final int URI_FIELD_NUMBER = 2;
158   /**
159    *
160    *
161    * <pre>
162    * URI that points to a file that contains audio data bytes as specified in
163    * `RecognitionConfig`. The file must not be compressed (for example, gzip).
164    * Currently, only Google Cloud Storage URIs are
165    * supported, which must be specified in the following format:
166    * `gs://bucket_name/object_name` (other URI formats return
167    * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
168    * For more information, see [Request
169    * URIs](https://cloud.google.com/storage/docs/reference-uris).
170    * </pre>
171    *
172    * <code>string uri = 2;</code>
173    *
174    * @return Whether the uri field is set.
175    */
hasUri()176   public boolean hasUri() {
177     return audioSourceCase_ == 2;
178   }
179   /**
180    *
181    *
182    * <pre>
183    * URI that points to a file that contains audio data bytes as specified in
184    * `RecognitionConfig`. The file must not be compressed (for example, gzip).
185    * Currently, only Google Cloud Storage URIs are
186    * supported, which must be specified in the following format:
187    * `gs://bucket_name/object_name` (other URI formats return
188    * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
189    * For more information, see [Request
190    * URIs](https://cloud.google.com/storage/docs/reference-uris).
191    * </pre>
192    *
193    * <code>string uri = 2;</code>
194    *
195    * @return The uri.
196    */
getUri()197   public java.lang.String getUri() {
198     java.lang.Object ref = "";
199     if (audioSourceCase_ == 2) {
200       ref = audioSource_;
201     }
202     if (ref instanceof java.lang.String) {
203       return (java.lang.String) ref;
204     } else {
205       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
206       java.lang.String s = bs.toStringUtf8();
207       if (audioSourceCase_ == 2) {
208         audioSource_ = s;
209       }
210       return s;
211     }
212   }
213   /**
214    *
215    *
216    * <pre>
217    * URI that points to a file that contains audio data bytes as specified in
218    * `RecognitionConfig`. The file must not be compressed (for example, gzip).
219    * Currently, only Google Cloud Storage URIs are
220    * supported, which must be specified in the following format:
221    * `gs://bucket_name/object_name` (other URI formats return
222    * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
223    * For more information, see [Request
224    * URIs](https://cloud.google.com/storage/docs/reference-uris).
225    * </pre>
226    *
227    * <code>string uri = 2;</code>
228    *
229    * @return The bytes for uri.
230    */
getUriBytes()231   public com.google.protobuf.ByteString getUriBytes() {
232     java.lang.Object ref = "";
233     if (audioSourceCase_ == 2) {
234       ref = audioSource_;
235     }
236     if (ref instanceof java.lang.String) {
237       com.google.protobuf.ByteString b =
238           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
239       if (audioSourceCase_ == 2) {
240         audioSource_ = b;
241       }
242       return b;
243     } else {
244       return (com.google.protobuf.ByteString) ref;
245     }
246   }
247 
248   private byte memoizedIsInitialized = -1;
249 
250   @java.lang.Override
isInitialized()251   public final boolean isInitialized() {
252     byte isInitialized = memoizedIsInitialized;
253     if (isInitialized == 1) return true;
254     if (isInitialized == 0) return false;
255 
256     memoizedIsInitialized = 1;
257     return true;
258   }
259 
260   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)261   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
262     if (audioSourceCase_ == 1) {
263       output.writeBytes(1, (com.google.protobuf.ByteString) audioSource_);
264     }
265     if (audioSourceCase_ == 2) {
266       com.google.protobuf.GeneratedMessageV3.writeString(output, 2, audioSource_);
267     }
268     getUnknownFields().writeTo(output);
269   }
270 
271   @java.lang.Override
getSerializedSize()272   public int getSerializedSize() {
273     int size = memoizedSize;
274     if (size != -1) return size;
275 
276     size = 0;
277     if (audioSourceCase_ == 1) {
278       size +=
279           com.google.protobuf.CodedOutputStream.computeBytesSize(
280               1, (com.google.protobuf.ByteString) audioSource_);
281     }
282     if (audioSourceCase_ == 2) {
283       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, audioSource_);
284     }
285     size += getUnknownFields().getSerializedSize();
286     memoizedSize = size;
287     return size;
288   }
289 
290   @java.lang.Override
equals(final java.lang.Object obj)291   public boolean equals(final java.lang.Object obj) {
292     if (obj == this) {
293       return true;
294     }
295     if (!(obj instanceof com.google.cloud.speech.v1.RecognitionAudio)) {
296       return super.equals(obj);
297     }
298     com.google.cloud.speech.v1.RecognitionAudio other =
299         (com.google.cloud.speech.v1.RecognitionAudio) obj;
300 
301     if (!getAudioSourceCase().equals(other.getAudioSourceCase())) return false;
302     switch (audioSourceCase_) {
303       case 1:
304         if (!getContent().equals(other.getContent())) return false;
305         break;
306       case 2:
307         if (!getUri().equals(other.getUri())) return false;
308         break;
309       case 0:
310       default:
311     }
312     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
313     return true;
314   }
315 
316   @java.lang.Override
hashCode()317   public int hashCode() {
318     if (memoizedHashCode != 0) {
319       return memoizedHashCode;
320     }
321     int hash = 41;
322     hash = (19 * hash) + getDescriptor().hashCode();
323     switch (audioSourceCase_) {
324       case 1:
325         hash = (37 * hash) + CONTENT_FIELD_NUMBER;
326         hash = (53 * hash) + getContent().hashCode();
327         break;
328       case 2:
329         hash = (37 * hash) + URI_FIELD_NUMBER;
330         hash = (53 * hash) + getUri().hashCode();
331         break;
332       case 0:
333       default:
334     }
335     hash = (29 * hash) + getUnknownFields().hashCode();
336     memoizedHashCode = hash;
337     return hash;
338   }
339 
parseFrom(java.nio.ByteBuffer data)340   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(java.nio.ByteBuffer data)
341       throws com.google.protobuf.InvalidProtocolBufferException {
342     return PARSER.parseFrom(data);
343   }
344 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)345   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
346       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
347       throws com.google.protobuf.InvalidProtocolBufferException {
348     return PARSER.parseFrom(data, extensionRegistry);
349   }
350 
parseFrom( com.google.protobuf.ByteString data)351   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
352       com.google.protobuf.ByteString data)
353       throws com.google.protobuf.InvalidProtocolBufferException {
354     return PARSER.parseFrom(data);
355   }
356 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)357   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
358       com.google.protobuf.ByteString data,
359       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
360       throws com.google.protobuf.InvalidProtocolBufferException {
361     return PARSER.parseFrom(data, extensionRegistry);
362   }
363 
parseFrom(byte[] data)364   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(byte[] data)
365       throws com.google.protobuf.InvalidProtocolBufferException {
366     return PARSER.parseFrom(data);
367   }
368 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)369   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
370       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
371       throws com.google.protobuf.InvalidProtocolBufferException {
372     return PARSER.parseFrom(data, extensionRegistry);
373   }
374 
parseFrom(java.io.InputStream input)375   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(java.io.InputStream input)
376       throws java.io.IOException {
377     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
378   }
379 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)380   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
381       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
382       throws java.io.IOException {
383     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
384         PARSER, input, extensionRegistry);
385   }
386 
parseDelimitedFrom( java.io.InputStream input)387   public static com.google.cloud.speech.v1.RecognitionAudio parseDelimitedFrom(
388       java.io.InputStream input) throws java.io.IOException {
389     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
390   }
391 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)392   public static com.google.cloud.speech.v1.RecognitionAudio parseDelimitedFrom(
393       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
394       throws java.io.IOException {
395     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
396         PARSER, input, extensionRegistry);
397   }
398 
parseFrom( com.google.protobuf.CodedInputStream input)399   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
400       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
401     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
402   }
403 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)404   public static com.google.cloud.speech.v1.RecognitionAudio parseFrom(
405       com.google.protobuf.CodedInputStream input,
406       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
407       throws java.io.IOException {
408     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
409         PARSER, input, extensionRegistry);
410   }
411 
412   @java.lang.Override
newBuilderForType()413   public Builder newBuilderForType() {
414     return newBuilder();
415   }
416 
newBuilder()417   public static Builder newBuilder() {
418     return DEFAULT_INSTANCE.toBuilder();
419   }
420 
newBuilder(com.google.cloud.speech.v1.RecognitionAudio prototype)421   public static Builder newBuilder(com.google.cloud.speech.v1.RecognitionAudio prototype) {
422     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
423   }
424 
425   @java.lang.Override
toBuilder()426   public Builder toBuilder() {
427     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
428   }
429 
430   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)431   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
432     Builder builder = new Builder(parent);
433     return builder;
434   }
435   /**
436    *
437    *
438    * <pre>
439    * Contains audio data in the encoding specified in the `RecognitionConfig`.
440    * Either `content` or `uri` must be supplied. Supplying both or neither
441    * returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
442    * See [content limits](https://cloud.google.com/speech-to-text/quotas#content).
443    * </pre>
444    *
445    * Protobuf type {@code google.cloud.speech.v1.RecognitionAudio}
446    */
447   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
448       implements
449       // @@protoc_insertion_point(builder_implements:google.cloud.speech.v1.RecognitionAudio)
450       com.google.cloud.speech.v1.RecognitionAudioOrBuilder {
getDescriptor()451     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
452       return com.google.cloud.speech.v1.SpeechProto
453           .internal_static_google_cloud_speech_v1_RecognitionAudio_descriptor;
454     }
455 
456     @java.lang.Override
457     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()458         internalGetFieldAccessorTable() {
459       return com.google.cloud.speech.v1.SpeechProto
460           .internal_static_google_cloud_speech_v1_RecognitionAudio_fieldAccessorTable
461           .ensureFieldAccessorsInitialized(
462               com.google.cloud.speech.v1.RecognitionAudio.class,
463               com.google.cloud.speech.v1.RecognitionAudio.Builder.class);
464     }
465 
466     // Construct using com.google.cloud.speech.v1.RecognitionAudio.newBuilder()
Builder()467     private Builder() {}
468 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)469     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
470       super(parent);
471     }
472 
473     @java.lang.Override
clear()474     public Builder clear() {
475       super.clear();
476       bitField0_ = 0;
477       audioSourceCase_ = 0;
478       audioSource_ = null;
479       return this;
480     }
481 
482     @java.lang.Override
getDescriptorForType()483     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
484       return com.google.cloud.speech.v1.SpeechProto
485           .internal_static_google_cloud_speech_v1_RecognitionAudio_descriptor;
486     }
487 
488     @java.lang.Override
getDefaultInstanceForType()489     public com.google.cloud.speech.v1.RecognitionAudio getDefaultInstanceForType() {
490       return com.google.cloud.speech.v1.RecognitionAudio.getDefaultInstance();
491     }
492 
493     @java.lang.Override
build()494     public com.google.cloud.speech.v1.RecognitionAudio build() {
495       com.google.cloud.speech.v1.RecognitionAudio result = buildPartial();
496       if (!result.isInitialized()) {
497         throw newUninitializedMessageException(result);
498       }
499       return result;
500     }
501 
502     @java.lang.Override
buildPartial()503     public com.google.cloud.speech.v1.RecognitionAudio buildPartial() {
504       com.google.cloud.speech.v1.RecognitionAudio result =
505           new com.google.cloud.speech.v1.RecognitionAudio(this);
506       if (bitField0_ != 0) {
507         buildPartial0(result);
508       }
509       buildPartialOneofs(result);
510       onBuilt();
511       return result;
512     }
513 
buildPartial0(com.google.cloud.speech.v1.RecognitionAudio result)514     private void buildPartial0(com.google.cloud.speech.v1.RecognitionAudio result) {
515       int from_bitField0_ = bitField0_;
516     }
517 
buildPartialOneofs(com.google.cloud.speech.v1.RecognitionAudio result)518     private void buildPartialOneofs(com.google.cloud.speech.v1.RecognitionAudio result) {
519       result.audioSourceCase_ = audioSourceCase_;
520       result.audioSource_ = this.audioSource_;
521     }
522 
523     @java.lang.Override
clone()524     public Builder clone() {
525       return super.clone();
526     }
527 
528     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)529     public Builder setField(
530         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
531       return super.setField(field, value);
532     }
533 
534     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)535     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
536       return super.clearField(field);
537     }
538 
539     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)540     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
541       return super.clearOneof(oneof);
542     }
543 
544     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)545     public Builder setRepeatedField(
546         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
547       return super.setRepeatedField(field, index, value);
548     }
549 
550     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)551     public Builder addRepeatedField(
552         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
553       return super.addRepeatedField(field, value);
554     }
555 
556     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)557     public Builder mergeFrom(com.google.protobuf.Message other) {
558       if (other instanceof com.google.cloud.speech.v1.RecognitionAudio) {
559         return mergeFrom((com.google.cloud.speech.v1.RecognitionAudio) other);
560       } else {
561         super.mergeFrom(other);
562         return this;
563       }
564     }
565 
mergeFrom(com.google.cloud.speech.v1.RecognitionAudio other)566     public Builder mergeFrom(com.google.cloud.speech.v1.RecognitionAudio other) {
567       if (other == com.google.cloud.speech.v1.RecognitionAudio.getDefaultInstance()) return this;
568       switch (other.getAudioSourceCase()) {
569         case CONTENT:
570           {
571             setContent(other.getContent());
572             break;
573           }
574         case URI:
575           {
576             audioSourceCase_ = 2;
577             audioSource_ = other.audioSource_;
578             onChanged();
579             break;
580           }
581         case AUDIOSOURCE_NOT_SET:
582           {
583             break;
584           }
585       }
586       this.mergeUnknownFields(other.getUnknownFields());
587       onChanged();
588       return this;
589     }
590 
591     @java.lang.Override
isInitialized()592     public final boolean isInitialized() {
593       return true;
594     }
595 
596     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)597     public Builder mergeFrom(
598         com.google.protobuf.CodedInputStream input,
599         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
600         throws java.io.IOException {
601       if (extensionRegistry == null) {
602         throw new java.lang.NullPointerException();
603       }
604       try {
605         boolean done = false;
606         while (!done) {
607           int tag = input.readTag();
608           switch (tag) {
609             case 0:
610               done = true;
611               break;
612             case 10:
613               {
614                 audioSource_ = input.readBytes();
615                 audioSourceCase_ = 1;
616                 break;
617               } // case 10
618             case 18:
619               {
620                 java.lang.String s = input.readStringRequireUtf8();
621                 audioSourceCase_ = 2;
622                 audioSource_ = s;
623                 break;
624               } // case 18
625             default:
626               {
627                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
628                   done = true; // was an endgroup tag
629                 }
630                 break;
631               } // default:
632           } // switch (tag)
633         } // while (!done)
634       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
635         throw e.unwrapIOException();
636       } finally {
637         onChanged();
638       } // finally
639       return this;
640     }
641 
642     private int audioSourceCase_ = 0;
643     private java.lang.Object audioSource_;
644 
getAudioSourceCase()645     public AudioSourceCase getAudioSourceCase() {
646       return AudioSourceCase.forNumber(audioSourceCase_);
647     }
648 
clearAudioSource()649     public Builder clearAudioSource() {
650       audioSourceCase_ = 0;
651       audioSource_ = null;
652       onChanged();
653       return this;
654     }
655 
656     private int bitField0_;
657 
658     /**
659      *
660      *
661      * <pre>
662      * The audio data bytes encoded as specified in
663      * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
664      * pure binary representation, whereas JSON representations use base64.
665      * </pre>
666      *
667      * <code>bytes content = 1;</code>
668      *
669      * @return Whether the content field is set.
670      */
hasContent()671     public boolean hasContent() {
672       return audioSourceCase_ == 1;
673     }
674     /**
675      *
676      *
677      * <pre>
678      * The audio data bytes encoded as specified in
679      * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
680      * pure binary representation, whereas JSON representations use base64.
681      * </pre>
682      *
683      * <code>bytes content = 1;</code>
684      *
685      * @return The content.
686      */
getContent()687     public com.google.protobuf.ByteString getContent() {
688       if (audioSourceCase_ == 1) {
689         return (com.google.protobuf.ByteString) audioSource_;
690       }
691       return com.google.protobuf.ByteString.EMPTY;
692     }
693     /**
694      *
695      *
696      * <pre>
697      * The audio data bytes encoded as specified in
698      * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
699      * pure binary representation, whereas JSON representations use base64.
700      * </pre>
701      *
702      * <code>bytes content = 1;</code>
703      *
704      * @param value The content to set.
705      * @return This builder for chaining.
706      */
setContent(com.google.protobuf.ByteString value)707     public Builder setContent(com.google.protobuf.ByteString value) {
708       if (value == null) {
709         throw new NullPointerException();
710       }
711       audioSourceCase_ = 1;
712       audioSource_ = value;
713       onChanged();
714       return this;
715     }
716     /**
717      *
718      *
719      * <pre>
720      * The audio data bytes encoded as specified in
721      * `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
722      * pure binary representation, whereas JSON representations use base64.
723      * </pre>
724      *
725      * <code>bytes content = 1;</code>
726      *
727      * @return This builder for chaining.
728      */
clearContent()729     public Builder clearContent() {
730       if (audioSourceCase_ == 1) {
731         audioSourceCase_ = 0;
732         audioSource_ = null;
733         onChanged();
734       }
735       return this;
736     }
737 
738     /**
739      *
740      *
741      * <pre>
742      * URI that points to a file that contains audio data bytes as specified in
743      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
744      * Currently, only Google Cloud Storage URIs are
745      * supported, which must be specified in the following format:
746      * `gs://bucket_name/object_name` (other URI formats return
747      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
748      * For more information, see [Request
749      * URIs](https://cloud.google.com/storage/docs/reference-uris).
750      * </pre>
751      *
752      * <code>string uri = 2;</code>
753      *
754      * @return Whether the uri field is set.
755      */
756     @java.lang.Override
hasUri()757     public boolean hasUri() {
758       return audioSourceCase_ == 2;
759     }
760     /**
761      *
762      *
763      * <pre>
764      * URI that points to a file that contains audio data bytes as specified in
765      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
766      * Currently, only Google Cloud Storage URIs are
767      * supported, which must be specified in the following format:
768      * `gs://bucket_name/object_name` (other URI formats return
769      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
770      * For more information, see [Request
771      * URIs](https://cloud.google.com/storage/docs/reference-uris).
772      * </pre>
773      *
774      * <code>string uri = 2;</code>
775      *
776      * @return The uri.
777      */
778     @java.lang.Override
getUri()779     public java.lang.String getUri() {
780       java.lang.Object ref = "";
781       if (audioSourceCase_ == 2) {
782         ref = audioSource_;
783       }
784       if (!(ref instanceof java.lang.String)) {
785         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
786         java.lang.String s = bs.toStringUtf8();
787         if (audioSourceCase_ == 2) {
788           audioSource_ = s;
789         }
790         return s;
791       } else {
792         return (java.lang.String) ref;
793       }
794     }
795     /**
796      *
797      *
798      * <pre>
799      * URI that points to a file that contains audio data bytes as specified in
800      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
801      * Currently, only Google Cloud Storage URIs are
802      * supported, which must be specified in the following format:
803      * `gs://bucket_name/object_name` (other URI formats return
804      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
805      * For more information, see [Request
806      * URIs](https://cloud.google.com/storage/docs/reference-uris).
807      * </pre>
808      *
809      * <code>string uri = 2;</code>
810      *
811      * @return The bytes for uri.
812      */
813     @java.lang.Override
getUriBytes()814     public com.google.protobuf.ByteString getUriBytes() {
815       java.lang.Object ref = "";
816       if (audioSourceCase_ == 2) {
817         ref = audioSource_;
818       }
819       if (ref instanceof String) {
820         com.google.protobuf.ByteString b =
821             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
822         if (audioSourceCase_ == 2) {
823           audioSource_ = b;
824         }
825         return b;
826       } else {
827         return (com.google.protobuf.ByteString) ref;
828       }
829     }
830     /**
831      *
832      *
833      * <pre>
834      * URI that points to a file that contains audio data bytes as specified in
835      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
836      * Currently, only Google Cloud Storage URIs are
837      * supported, which must be specified in the following format:
838      * `gs://bucket_name/object_name` (other URI formats return
839      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
840      * For more information, see [Request
841      * URIs](https://cloud.google.com/storage/docs/reference-uris).
842      * </pre>
843      *
844      * <code>string uri = 2;</code>
845      *
846      * @param value The uri to set.
847      * @return This builder for chaining.
848      */
setUri(java.lang.String value)849     public Builder setUri(java.lang.String value) {
850       if (value == null) {
851         throw new NullPointerException();
852       }
853       audioSourceCase_ = 2;
854       audioSource_ = value;
855       onChanged();
856       return this;
857     }
858     /**
859      *
860      *
861      * <pre>
862      * URI that points to a file that contains audio data bytes as specified in
863      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
864      * Currently, only Google Cloud Storage URIs are
865      * supported, which must be specified in the following format:
866      * `gs://bucket_name/object_name` (other URI formats return
867      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
868      * For more information, see [Request
869      * URIs](https://cloud.google.com/storage/docs/reference-uris).
870      * </pre>
871      *
872      * <code>string uri = 2;</code>
873      *
874      * @return This builder for chaining.
875      */
clearUri()876     public Builder clearUri() {
877       if (audioSourceCase_ == 2) {
878         audioSourceCase_ = 0;
879         audioSource_ = null;
880         onChanged();
881       }
882       return this;
883     }
884     /**
885      *
886      *
887      * <pre>
888      * URI that points to a file that contains audio data bytes as specified in
889      * `RecognitionConfig`. The file must not be compressed (for example, gzip).
890      * Currently, only Google Cloud Storage URIs are
891      * supported, which must be specified in the following format:
892      * `gs://bucket_name/object_name` (other URI formats return
893      * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
894      * For more information, see [Request
895      * URIs](https://cloud.google.com/storage/docs/reference-uris).
896      * </pre>
897      *
898      * <code>string uri = 2;</code>
899      *
900      * @param value The bytes for uri to set.
901      * @return This builder for chaining.
902      */
setUriBytes(com.google.protobuf.ByteString value)903     public Builder setUriBytes(com.google.protobuf.ByteString value) {
904       if (value == null) {
905         throw new NullPointerException();
906       }
907       checkByteStringIsUtf8(value);
908       audioSourceCase_ = 2;
909       audioSource_ = value;
910       onChanged();
911       return this;
912     }
913 
914     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)915     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
916       return super.setUnknownFields(unknownFields);
917     }
918 
919     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)920     public final Builder mergeUnknownFields(
921         final com.google.protobuf.UnknownFieldSet unknownFields) {
922       return super.mergeUnknownFields(unknownFields);
923     }
924 
925     // @@protoc_insertion_point(builder_scope:google.cloud.speech.v1.RecognitionAudio)
926   }
927 
928   // @@protoc_insertion_point(class_scope:google.cloud.speech.v1.RecognitionAudio)
929   private static final com.google.cloud.speech.v1.RecognitionAudio DEFAULT_INSTANCE;
930 
931   static {
932     DEFAULT_INSTANCE = new com.google.cloud.speech.v1.RecognitionAudio();
933   }
934 
getDefaultInstance()935   public static com.google.cloud.speech.v1.RecognitionAudio getDefaultInstance() {
936     return DEFAULT_INSTANCE;
937   }
938 
939   private static final com.google.protobuf.Parser<RecognitionAudio> PARSER =
940       new com.google.protobuf.AbstractParser<RecognitionAudio>() {
941         @java.lang.Override
942         public RecognitionAudio parsePartialFrom(
943             com.google.protobuf.CodedInputStream input,
944             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
945             throws com.google.protobuf.InvalidProtocolBufferException {
946           Builder builder = newBuilder();
947           try {
948             builder.mergeFrom(input, extensionRegistry);
949           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
950             throw e.setUnfinishedMessage(builder.buildPartial());
951           } catch (com.google.protobuf.UninitializedMessageException e) {
952             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
953           } catch (java.io.IOException e) {
954             throw new com.google.protobuf.InvalidProtocolBufferException(e)
955                 .setUnfinishedMessage(builder.buildPartial());
956           }
957           return builder.buildPartial();
958         }
959       };
960 
parser()961   public static com.google.protobuf.Parser<RecognitionAudio> parser() {
962     return PARSER;
963   }
964 
965   @java.lang.Override
getParserForType()966   public com.google.protobuf.Parser<RecognitionAudio> getParserForType() {
967     return PARSER;
968   }
969 
970   @java.lang.Override
getDefaultInstanceForType()971   public com.google.cloud.speech.v1.RecognitionAudio getDefaultInstanceForType() {
972     return DEFAULT_INSTANCE;
973   }
974 }
975