code: public void set(int index, byte value) {
          Preconditions.checkState(!this.readOnly, "Cannot modify a read-only ByteArraySegment.");
          Preconditions.checkElementIndex(index, this.length, "index");
          this.array[index + this.startOffset] = value;
      }
docs: Sets the value at the specified index.
  
  @param index The index to set the value at.
  @param value The value to set.
  @throws IllegalStateException          If the ByteArraySegment is readonly.
  @throws ArrayIndexOutOfBoundsException If index is invalid.