/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: google/storage/v2/storage.proto
// Protobuf Java Version: 4.33.2

package com.google.storage.v2;

/**
 *
 *
 * <pre>
 * Request message for
 * [BidiReadObject][google.storage.v2.Storage.BidiReadObject].
 * </pre>
 *
 * Protobuf type {@code google.storage.v2.BidiReadObjectRequest}
 */
@com.google.protobuf.Generated
public final class BidiReadObjectRequest extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.storage.v2.BidiReadObjectRequest)
    BidiReadObjectRequestOrBuilder {
  private static final long serialVersionUID = 0L;

  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
        /* major= */ 4,
        /* minor= */ 33,
        /* patch= */ 2,
        /* suffix= */ "",
        "BidiReadObjectRequest");
  }

  // Use BidiReadObjectRequest.newBuilder() to construct.
  private BidiReadObjectRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }

  private BidiReadObjectRequest() {
    readRanges_ = java.util.Collections.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.storage.v2.StorageProto
        .internal_static_google_storage_v2_BidiReadObjectRequest_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.storage.v2.StorageProto
        .internal_static_google_storage_v2_BidiReadObjectRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.storage.v2.BidiReadObjectRequest.class,
            com.google.storage.v2.BidiReadObjectRequest.Builder.class);
  }

  private int bitField0_;
  public static final int READ_OBJECT_SPEC_FIELD_NUMBER = 1;
  private com.google.storage.v2.BidiReadObjectSpec readObjectSpec_;

  /**
   *
   *
   * <pre>
   * Optional. The first message of each stream should set this field. If this
   * is not the first message, an error is returned. Describes the object to
   * read.
   * </pre>
   *
   * <code>
   * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return Whether the readObjectSpec field is set.
   */
  @java.lang.Override
  public boolean hasReadObjectSpec() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * Optional. The first message of each stream should set this field. If this
   * is not the first message, an error is returned. Describes the object to
   * read.
   * </pre>
   *
   * <code>
   * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The readObjectSpec.
   */
  @java.lang.Override
  public com.google.storage.v2.BidiReadObjectSpec getReadObjectSpec() {
    return readObjectSpec_ == null
        ? com.google.storage.v2.BidiReadObjectSpec.getDefaultInstance()
        : readObjectSpec_;
  }

  /**
   *
   *
   * <pre>
   * Optional. The first message of each stream should set this field. If this
   * is not the first message, an error is returned. Describes the object to
   * read.
   * </pre>
   *
   * <code>
   * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.storage.v2.BidiReadObjectSpecOrBuilder getReadObjectSpecOrBuilder() {
    return readObjectSpec_ == null
        ? com.google.storage.v2.BidiReadObjectSpec.getDefaultInstance()
        : readObjectSpec_;
  }

  public static final int READ_RANGES_FIELD_NUMBER = 8;

  @SuppressWarnings("serial")
  private java.util.List<com.google.storage.v2.ReadRange> readRanges_;

  /**
   *
   *
   * <pre>
   * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
   * single range is large enough to require multiple responses, they are
   * delivered in increasing offset order. There are no ordering guarantees
   * across ranges. When no ranges are provided, the response message
   * doesn't  include `ObjectRangeData`. For full object downloads, the
   * offset and size can be set to `0`.
   * </pre>
   *
   * <code>
   * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public java.util.List<com.google.storage.v2.ReadRange> getReadRangesList() {
    return readRanges_;
  }

  /**
   *
   *
   * <pre>
   * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
   * single range is large enough to require multiple responses, they are
   * delivered in increasing offset order. There are no ordering guarantees
   * across ranges. When no ranges are provided, the response message
   * doesn't  include `ObjectRangeData`. For full object downloads, the
   * offset and size can be set to `0`.
   * </pre>
   *
   * <code>
   * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.storage.v2.ReadRangeOrBuilder>
      getReadRangesOrBuilderList() {
    return readRanges_;
  }

  /**
   *
   *
   * <pre>
   * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
   * single range is large enough to require multiple responses, they are
   * delivered in increasing offset order. There are no ordering guarantees
   * across ranges. When no ranges are provided, the response message
   * doesn't  include `ObjectRangeData`. For full object downloads, the
   * offset and size can be set to `0`.
   * </pre>
   *
   * <code>
   * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public int getReadRangesCount() {
    return readRanges_.size();
  }

  /**
   *
   *
   * <pre>
   * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
   * single range is large enough to require multiple responses, they are
   * delivered in increasing offset order. There are no ordering guarantees
   * across ranges. When no ranges are provided, the response message
   * doesn't  include `ObjectRangeData`. For full object downloads, the
   * offset and size can be set to `0`.
   * </pre>
   *
   * <code>
   * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.storage.v2.ReadRange getReadRanges(int index) {
    return readRanges_.get(index);
  }

  /**
   *
   *
   * <pre>
   * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
   * single range is large enough to require multiple responses, they are
   * delivered in increasing offset order. There are no ordering guarantees
   * across ranges. When no ranges are provided, the response message
   * doesn't  include `ObjectRangeData`. For full object downloads, the
   * offset and size can be set to `0`.
   * </pre>
   *
   * <code>
   * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.storage.v2.ReadRangeOrBuilder getReadRangesOrBuilder(int index) {
    return readRanges_.get(index);
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(1, getReadObjectSpec());
    }
    for (int i = 0; i < readRanges_.size(); i++) {
      output.writeMessage(8, readRanges_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getReadObjectSpec());
    }
    for (int i = 0; i < readRanges_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, readRanges_.get(i));
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.storage.v2.BidiReadObjectRequest)) {
      return super.equals(obj);
    }
    com.google.storage.v2.BidiReadObjectRequest other =
        (com.google.storage.v2.BidiReadObjectRequest) obj;

    if (hasReadObjectSpec() != other.hasReadObjectSpec()) return false;
    if (hasReadObjectSpec()) {
      if (!getReadObjectSpec().equals(other.getReadObjectSpec())) return false;
    }
    if (!getReadRangesList().equals(other.getReadRangesList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasReadObjectSpec()) {
      hash = (37 * hash) + READ_OBJECT_SPEC_FIELD_NUMBER;
      hash = (53 * hash) + getReadObjectSpec().hashCode();
    }
    if (getReadRangesCount() > 0) {
      hash = (37 * hash) + READ_RANGES_FIELD_NUMBER;
      hash = (53 * hash) + getReadRangesList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.storage.v2.BidiReadObjectRequest 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.storage.v2.BidiReadObjectRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.BidiReadObjectRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.storage.v2.BidiReadObjectRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * Request message for
   * [BidiReadObject][google.storage.v2.Storage.BidiReadObject].
   * </pre>
   *
   * Protobuf type {@code google.storage.v2.BidiReadObjectRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.storage.v2.BidiReadObjectRequest)
      com.google.storage.v2.BidiReadObjectRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_BidiReadObjectRequest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_BidiReadObjectRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.storage.v2.BidiReadObjectRequest.class,
              com.google.storage.v2.BidiReadObjectRequest.Builder.class);
    }

    // Construct using com.google.storage.v2.BidiReadObjectRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        internalGetReadObjectSpecFieldBuilder();
        internalGetReadRangesFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      readObjectSpec_ = null;
      if (readObjectSpecBuilder_ != null) {
        readObjectSpecBuilder_.dispose();
        readObjectSpecBuilder_ = null;
      }
      if (readRangesBuilder_ == null) {
        readRanges_ = java.util.Collections.emptyList();
      } else {
        readRanges_ = null;
        readRangesBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_BidiReadObjectRequest_descriptor;
    }

    @java.lang.Override
    public com.google.storage.v2.BidiReadObjectRequest getDefaultInstanceForType() {
      return com.google.storage.v2.BidiReadObjectRequest.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.storage.v2.BidiReadObjectRequest build() {
      com.google.storage.v2.BidiReadObjectRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.storage.v2.BidiReadObjectRequest buildPartial() {
      com.google.storage.v2.BidiReadObjectRequest result =
          new com.google.storage.v2.BidiReadObjectRequest(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(com.google.storage.v2.BidiReadObjectRequest result) {
      if (readRangesBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          readRanges_ = java.util.Collections.unmodifiableList(readRanges_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.readRanges_ = readRanges_;
      } else {
        result.readRanges_ = readRangesBuilder_.build();
      }
    }

    private void buildPartial0(com.google.storage.v2.BidiReadObjectRequest result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.readObjectSpec_ =
            readObjectSpecBuilder_ == null ? readObjectSpec_ : readObjectSpecBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      result.bitField0_ |= to_bitField0_;
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.storage.v2.BidiReadObjectRequest) {
        return mergeFrom((com.google.storage.v2.BidiReadObjectRequest) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.storage.v2.BidiReadObjectRequest other) {
      if (other == com.google.storage.v2.BidiReadObjectRequest.getDefaultInstance()) return this;
      if (other.hasReadObjectSpec()) {
        mergeReadObjectSpec(other.getReadObjectSpec());
      }
      if (readRangesBuilder_ == null) {
        if (!other.readRanges_.isEmpty()) {
          if (readRanges_.isEmpty()) {
            readRanges_ = other.readRanges_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureReadRangesIsMutable();
            readRanges_.addAll(other.readRanges_);
          }
          onChanged();
        }
      } else {
        if (!other.readRanges_.isEmpty()) {
          if (readRangesBuilder_.isEmpty()) {
            readRangesBuilder_.dispose();
            readRangesBuilder_ = null;
            readRanges_ = other.readRanges_;
            bitField0_ = (bitField0_ & ~0x00000002);
            readRangesBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetReadRangesFieldBuilder()
                    : null;
          } else {
            readRangesBuilder_.addAllMessages(other.readRanges_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                input.readMessage(
                    internalGetReadObjectSpecFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 66:
              {
                com.google.storage.v2.ReadRange m =
                    input.readMessage(com.google.storage.v2.ReadRange.parser(), extensionRegistry);
                if (readRangesBuilder_ == null) {
                  ensureReadRangesIsMutable();
                  readRanges_.add(m);
                } else {
                  readRangesBuilder_.addMessage(m);
                }
                break;
              } // case 66
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private com.google.storage.v2.BidiReadObjectSpec readObjectSpec_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiReadObjectSpec,
            com.google.storage.v2.BidiReadObjectSpec.Builder,
            com.google.storage.v2.BidiReadObjectSpecOrBuilder>
        readObjectSpecBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the readObjectSpec field is set.
     */
    public boolean hasReadObjectSpec() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The readObjectSpec.
     */
    public com.google.storage.v2.BidiReadObjectSpec getReadObjectSpec() {
      if (readObjectSpecBuilder_ == null) {
        return readObjectSpec_ == null
            ? com.google.storage.v2.BidiReadObjectSpec.getDefaultInstance()
            : readObjectSpec_;
      } else {
        return readObjectSpecBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setReadObjectSpec(com.google.storage.v2.BidiReadObjectSpec value) {
      if (readObjectSpecBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        readObjectSpec_ = value;
      } else {
        readObjectSpecBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setReadObjectSpec(
        com.google.storage.v2.BidiReadObjectSpec.Builder builderForValue) {
      if (readObjectSpecBuilder_ == null) {
        readObjectSpec_ = builderForValue.build();
      } else {
        readObjectSpecBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder mergeReadObjectSpec(com.google.storage.v2.BidiReadObjectSpec value) {
      if (readObjectSpecBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && readObjectSpec_ != null
            && readObjectSpec_ != com.google.storage.v2.BidiReadObjectSpec.getDefaultInstance()) {
          getReadObjectSpecBuilder().mergeFrom(value);
        } else {
          readObjectSpec_ = value;
        }
      } else {
        readObjectSpecBuilder_.mergeFrom(value);
      }
      if (readObjectSpec_ != null) {
        bitField0_ |= 0x00000001;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearReadObjectSpec() {
      bitField0_ = (bitField0_ & ~0x00000001);
      readObjectSpec_ = null;
      if (readObjectSpecBuilder_ != null) {
        readObjectSpecBuilder_.dispose();
        readObjectSpecBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.BidiReadObjectSpec.Builder getReadObjectSpecBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return internalGetReadObjectSpecFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.BidiReadObjectSpecOrBuilder getReadObjectSpecOrBuilder() {
      if (readObjectSpecBuilder_ != null) {
        return readObjectSpecBuilder_.getMessageOrBuilder();
      } else {
        return readObjectSpec_ == null
            ? com.google.storage.v2.BidiReadObjectSpec.getDefaultInstance()
            : readObjectSpec_;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. The first message of each stream should set this field. If this
     * is not the first message, an error is returned. Describes the object to
     * read.
     * </pre>
     *
     * <code>
     * .google.storage.v2.BidiReadObjectSpec read_object_spec = 1 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiReadObjectSpec,
            com.google.storage.v2.BidiReadObjectSpec.Builder,
            com.google.storage.v2.BidiReadObjectSpecOrBuilder>
        internalGetReadObjectSpecFieldBuilder() {
      if (readObjectSpecBuilder_ == null) {
        readObjectSpecBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.storage.v2.BidiReadObjectSpec,
                com.google.storage.v2.BidiReadObjectSpec.Builder,
                com.google.storage.v2.BidiReadObjectSpecOrBuilder>(
                getReadObjectSpec(), getParentForChildren(), isClean());
        readObjectSpec_ = null;
      }
      return readObjectSpecBuilder_;
    }

    private java.util.List<com.google.storage.v2.ReadRange> readRanges_ =
        java.util.Collections.emptyList();

    private void ensureReadRangesIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        readRanges_ = new java.util.ArrayList<com.google.storage.v2.ReadRange>(readRanges_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.storage.v2.ReadRange,
            com.google.storage.v2.ReadRange.Builder,
            com.google.storage.v2.ReadRangeOrBuilder>
        readRangesBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public java.util.List<com.google.storage.v2.ReadRange> getReadRangesList() {
      if (readRangesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(readRanges_);
      } else {
        return readRangesBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public int getReadRangesCount() {
      if (readRangesBuilder_ == null) {
        return readRanges_.size();
      } else {
        return readRangesBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.ReadRange getReadRanges(int index) {
      if (readRangesBuilder_ == null) {
        return readRanges_.get(index);
      } else {
        return readRangesBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setReadRanges(int index, com.google.storage.v2.ReadRange value) {
      if (readRangesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureReadRangesIsMutable();
        readRanges_.set(index, value);
        onChanged();
      } else {
        readRangesBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setReadRanges(
        int index, com.google.storage.v2.ReadRange.Builder builderForValue) {
      if (readRangesBuilder_ == null) {
        ensureReadRangesIsMutable();
        readRanges_.set(index, builderForValue.build());
        onChanged();
      } else {
        readRangesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder addReadRanges(com.google.storage.v2.ReadRange value) {
      if (readRangesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureReadRangesIsMutable();
        readRanges_.add(value);
        onChanged();
      } else {
        readRangesBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder addReadRanges(int index, com.google.storage.v2.ReadRange value) {
      if (readRangesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureReadRangesIsMutable();
        readRanges_.add(index, value);
        onChanged();
      } else {
        readRangesBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder addReadRanges(com.google.storage.v2.ReadRange.Builder builderForValue) {
      if (readRangesBuilder_ == null) {
        ensureReadRangesIsMutable();
        readRanges_.add(builderForValue.build());
        onChanged();
      } else {
        readRangesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder addReadRanges(
        int index, com.google.storage.v2.ReadRange.Builder builderForValue) {
      if (readRangesBuilder_ == null) {
        ensureReadRangesIsMutable();
        readRanges_.add(index, builderForValue.build());
        onChanged();
      } else {
        readRangesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder addAllReadRanges(
        java.lang.Iterable<? extends com.google.storage.v2.ReadRange> values) {
      if (readRangesBuilder_ == null) {
        ensureReadRangesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, readRanges_);
        onChanged();
      } else {
        readRangesBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearReadRanges() {
      if (readRangesBuilder_ == null) {
        readRanges_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        readRangesBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder removeReadRanges(int index) {
      if (readRangesBuilder_ == null) {
        ensureReadRangesIsMutable();
        readRanges_.remove(index);
        onChanged();
      } else {
        readRangesBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.ReadRange.Builder getReadRangesBuilder(int index) {
      return internalGetReadRangesFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.ReadRangeOrBuilder getReadRangesOrBuilder(int index) {
      if (readRangesBuilder_ == null) {
        return readRanges_.get(index);
      } else {
        return readRangesBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public java.util.List<? extends com.google.storage.v2.ReadRangeOrBuilder>
        getReadRangesOrBuilderList() {
      if (readRangesBuilder_ != null) {
        return readRangesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(readRanges_);
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.ReadRange.Builder addReadRangesBuilder() {
      return internalGetReadRangesFieldBuilder()
          .addBuilder(com.google.storage.v2.ReadRange.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.storage.v2.ReadRange.Builder addReadRangesBuilder(int index) {
      return internalGetReadRangesFieldBuilder()
          .addBuilder(index, com.google.storage.v2.ReadRange.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * Optional. Provides a list of 0 or more (up to 100) ranges to read. If a
     * single range is large enough to require multiple responses, they are
     * delivered in increasing offset order. There are no ordering guarantees
     * across ranges. When no ranges are provided, the response message
     * doesn't  include `ObjectRangeData`. For full object downloads, the
     * offset and size can be set to `0`.
     * </pre>
     *
     * <code>
     * repeated .google.storage.v2.ReadRange read_ranges = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public java.util.List<com.google.storage.v2.ReadRange.Builder> getReadRangesBuilderList() {
      return internalGetReadRangesFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.storage.v2.ReadRange,
            com.google.storage.v2.ReadRange.Builder,
            com.google.storage.v2.ReadRangeOrBuilder>
        internalGetReadRangesFieldBuilder() {
      if (readRangesBuilder_ == null) {
        readRangesBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.storage.v2.ReadRange,
                com.google.storage.v2.ReadRange.Builder,
                com.google.storage.v2.ReadRangeOrBuilder>(
                readRanges_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
        readRanges_ = null;
      }
      return readRangesBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.storage.v2.BidiReadObjectRequest)
  }

  // @@protoc_insertion_point(class_scope:google.storage.v2.BidiReadObjectRequest)
  private static final com.google.storage.v2.BidiReadObjectRequest DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.storage.v2.BidiReadObjectRequest();
  }

  public static com.google.storage.v2.BidiReadObjectRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<BidiReadObjectRequest> PARSER =
      new com.google.protobuf.AbstractParser<BidiReadObjectRequest>() {
        @java.lang.Override
        public BidiReadObjectRequest parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<BidiReadObjectRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<BidiReadObjectRequest> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.storage.v2.BidiReadObjectRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
