/*
 * 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>
 * Error proto containing details for a redirected read. This error might be
 * attached as details for an ABORTED response to BidiReadObject.
 * </pre>
 *
 * Protobuf type {@code google.storage.v2.BidiReadObjectRedirectedError}
 */
@com.google.protobuf.Generated
public final class BidiReadObjectRedirectedError extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.storage.v2.BidiReadObjectRedirectedError)
    BidiReadObjectRedirectedErrorOrBuilder {
  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= */ "",
        "BidiReadObjectRedirectedError");
  }

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

  private BidiReadObjectRedirectedError() {
    routingToken_ = "";
  }

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

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

  private int bitField0_;
  public static final int READ_HANDLE_FIELD_NUMBER = 1;
  private com.google.storage.v2.BidiReadHandle readHandle_;

  /**
   *
   *
   * <pre>
   * The read handle for the redirected read. If set, the client might use this
   * in the BidiReadObjectSpec when retrying the read stream.
   * </pre>
   *
   * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
   *
   * @return Whether the readHandle field is set.
   */
  @java.lang.Override
  public boolean hasReadHandle() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * The read handle for the redirected read. If set, the client might use this
   * in the BidiReadObjectSpec when retrying the read stream.
   * </pre>
   *
   * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
   *
   * @return The readHandle.
   */
  @java.lang.Override
  public com.google.storage.v2.BidiReadHandle getReadHandle() {
    return readHandle_ == null
        ? com.google.storage.v2.BidiReadHandle.getDefaultInstance()
        : readHandle_;
  }

  /**
   *
   *
   * <pre>
   * The read handle for the redirected read. If set, the client might use this
   * in the BidiReadObjectSpec when retrying the read stream.
   * </pre>
   *
   * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
   */
  @java.lang.Override
  public com.google.storage.v2.BidiReadHandleOrBuilder getReadHandleOrBuilder() {
    return readHandle_ == null
        ? com.google.storage.v2.BidiReadHandle.getDefaultInstance()
        : readHandle_;
  }

  public static final int ROUTING_TOKEN_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object routingToken_ = "";

  /**
   *
   *
   * <pre>
   * The routing token the client must use when retrying the read stream.
   * This value must be provided in the header `x-goog-request-params`, with key
   * `routing_token` and this string verbatim as the value.
   * </pre>
   *
   * <code>optional string routing_token = 2;</code>
   *
   * @return Whether the routingToken field is set.
   */
  @java.lang.Override
  public boolean hasRoutingToken() {
    return ((bitField0_ & 0x00000002) != 0);
  }

  /**
   *
   *
   * <pre>
   * The routing token the client must use when retrying the read stream.
   * This value must be provided in the header `x-goog-request-params`, with key
   * `routing_token` and this string verbatim as the value.
   * </pre>
   *
   * <code>optional string routing_token = 2;</code>
   *
   * @return The routingToken.
   */
  @java.lang.Override
  public java.lang.String getRoutingToken() {
    java.lang.Object ref = routingToken_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      routingToken_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * The routing token the client must use when retrying the read stream.
   * This value must be provided in the header `x-goog-request-params`, with key
   * `routing_token` and this string verbatim as the value.
   * </pre>
   *
   * <code>optional string routing_token = 2;</code>
   *
   * @return The bytes for routingToken.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getRoutingTokenBytes() {
    java.lang.Object ref = routingToken_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      routingToken_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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, getReadHandle());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 2, routingToken_);
    }
    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, getReadHandle());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(2, routingToken_);
    }
    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.BidiReadObjectRedirectedError)) {
      return super.equals(obj);
    }
    com.google.storage.v2.BidiReadObjectRedirectedError other =
        (com.google.storage.v2.BidiReadObjectRedirectedError) obj;

    if (hasReadHandle() != other.hasReadHandle()) return false;
    if (hasReadHandle()) {
      if (!getReadHandle().equals(other.getReadHandle())) return false;
    }
    if (hasRoutingToken() != other.hasRoutingToken()) return false;
    if (hasRoutingToken()) {
      if (!getRoutingToken().equals(other.getRoutingToken())) 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 (hasReadHandle()) {
      hash = (37 * hash) + READ_HANDLE_FIELD_NUMBER;
      hash = (53 * hash) + getReadHandle().hashCode();
    }
    if (hasRoutingToken()) {
      hash = (37 * hash) + ROUTING_TOKEN_FIELD_NUMBER;
      hash = (53 * hash) + getRoutingToken().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

  public static com.google.storage.v2.BidiReadObjectRedirectedError 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.BidiReadObjectRedirectedError parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.BidiReadObjectRedirectedError 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.BidiReadObjectRedirectedError parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.BidiReadObjectRedirectedError 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.BidiReadObjectRedirectedError 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>
   * Error proto containing details for a redirected read. This error might be
   * attached as details for an ABORTED response to BidiReadObject.
   * </pre>
   *
   * Protobuf type {@code google.storage.v2.BidiReadObjectRedirectedError}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.storage.v2.BidiReadObjectRedirectedError)
      com.google.storage.v2.BidiReadObjectRedirectedErrorOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_BidiReadObjectRedirectedError_descriptor;
    }

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

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

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      readHandle_ = null;
      if (readHandleBuilder_ != null) {
        readHandleBuilder_.dispose();
        readHandleBuilder_ = null;
      }
      routingToken_ = "";
      return this;
    }

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

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

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

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

    private void buildPartial0(com.google.storage.v2.BidiReadObjectRedirectedError result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.readHandle_ = readHandleBuilder_ == null ? readHandle_ : readHandleBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.routingToken_ = routingToken_;
        to_bitField0_ |= 0x00000002;
      }
      result.bitField0_ |= to_bitField0_;
    }

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

    public Builder mergeFrom(com.google.storage.v2.BidiReadObjectRedirectedError other) {
      if (other == com.google.storage.v2.BidiReadObjectRedirectedError.getDefaultInstance())
        return this;
      if (other.hasReadHandle()) {
        mergeReadHandle(other.getReadHandle());
      }
      if (other.hasRoutingToken()) {
        routingToken_ = other.routingToken_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      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(
                    internalGetReadHandleFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                routingToken_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            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.BidiReadHandle readHandle_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiReadHandle,
            com.google.storage.v2.BidiReadHandle.Builder,
            com.google.storage.v2.BidiReadHandleOrBuilder>
        readHandleBuilder_;

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     *
     * @return Whether the readHandle field is set.
     */
    public boolean hasReadHandle() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     *
     * @return The readHandle.
     */
    public com.google.storage.v2.BidiReadHandle getReadHandle() {
      if (readHandleBuilder_ == null) {
        return readHandle_ == null
            ? com.google.storage.v2.BidiReadHandle.getDefaultInstance()
            : readHandle_;
      } else {
        return readHandleBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public Builder setReadHandle(com.google.storage.v2.BidiReadHandle value) {
      if (readHandleBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        readHandle_ = value;
      } else {
        readHandleBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public Builder setReadHandle(com.google.storage.v2.BidiReadHandle.Builder builderForValue) {
      if (readHandleBuilder_ == null) {
        readHandle_ = builderForValue.build();
      } else {
        readHandleBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public Builder mergeReadHandle(com.google.storage.v2.BidiReadHandle value) {
      if (readHandleBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && readHandle_ != null
            && readHandle_ != com.google.storage.v2.BidiReadHandle.getDefaultInstance()) {
          getReadHandleBuilder().mergeFrom(value);
        } else {
          readHandle_ = value;
        }
      } else {
        readHandleBuilder_.mergeFrom(value);
      }
      if (readHandle_ != null) {
        bitField0_ |= 0x00000001;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public Builder clearReadHandle() {
      bitField0_ = (bitField0_ & ~0x00000001);
      readHandle_ = null;
      if (readHandleBuilder_ != null) {
        readHandleBuilder_.dispose();
        readHandleBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public com.google.storage.v2.BidiReadHandle.Builder getReadHandleBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return internalGetReadHandleFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    public com.google.storage.v2.BidiReadHandleOrBuilder getReadHandleOrBuilder() {
      if (readHandleBuilder_ != null) {
        return readHandleBuilder_.getMessageOrBuilder();
      } else {
        return readHandle_ == null
            ? com.google.storage.v2.BidiReadHandle.getDefaultInstance()
            : readHandle_;
      }
    }

    /**
     *
     *
     * <pre>
     * The read handle for the redirected read. If set, the client might use this
     * in the BidiReadObjectSpec when retrying the read stream.
     * </pre>
     *
     * <code>.google.storage.v2.BidiReadHandle read_handle = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiReadHandle,
            com.google.storage.v2.BidiReadHandle.Builder,
            com.google.storage.v2.BidiReadHandleOrBuilder>
        internalGetReadHandleFieldBuilder() {
      if (readHandleBuilder_ == null) {
        readHandleBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.storage.v2.BidiReadHandle,
                com.google.storage.v2.BidiReadHandle.Builder,
                com.google.storage.v2.BidiReadHandleOrBuilder>(
                getReadHandle(), getParentForChildren(), isClean());
        readHandle_ = null;
      }
      return readHandleBuilder_;
    }

    private java.lang.Object routingToken_ = "";

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @return Whether the routingToken field is set.
     */
    public boolean hasRoutingToken() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @return The routingToken.
     */
    public java.lang.String getRoutingToken() {
      java.lang.Object ref = routingToken_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        routingToken_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @return The bytes for routingToken.
     */
    public com.google.protobuf.ByteString getRoutingTokenBytes() {
      java.lang.Object ref = routingToken_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        routingToken_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @param value The routingToken to set.
     * @return This builder for chaining.
     */
    public Builder setRoutingToken(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      routingToken_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRoutingToken() {
      routingToken_ = getDefaultInstance().getRoutingToken();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The routing token the client must use when retrying the read stream.
     * This value must be provided in the header `x-goog-request-params`, with key
     * `routing_token` and this string verbatim as the value.
     * </pre>
     *
     * <code>optional string routing_token = 2;</code>
     *
     * @param value The bytes for routingToken to set.
     * @return This builder for chaining.
     */
    public Builder setRoutingTokenBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      routingToken_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

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

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

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

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

  private static final com.google.protobuf.Parser<BidiReadObjectRedirectedError> PARSER =
      new com.google.protobuf.AbstractParser<BidiReadObjectRedirectedError>() {
        @java.lang.Override
        public BidiReadObjectRedirectedError 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<BidiReadObjectRedirectedError> parser() {
    return PARSER;
  }

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

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