parquet-common/src/main/java/org/apache/parquet/bytes/CapacityByteArrayOutputStream.java
public void setByte(long index, byte value) {
    checkArgument(index < bytesUsed, "Index: " + index + " is >= the current size of: " + bytesUsed);

    long seen = 0;
    for (int i = 0; i < slabs.size(); i++) {
      ByteBuffer slab = slabs.get(i);
      if (index < seen + slab.limit()) {
        // ok found index
        slab.put((int)(index-seen), value);
        break;
      }
      seen += slab.limit();
    }
  }
public void setByte(long index, byte value) {
    checkArgument(index < bytesUsed, "Index: " + index + " is >= the current size of: " + bytesUsed);

    long seen = 0;
    for (int i = 0; i < slabs.size(); i++) {
      ByteBuffer slab = slabs.get(i);
      if (index < seen + slab.limit()) {
        // ok found index
        slab.put((int)(index-seen), value);
        break;
      }
      seen += slab.limit();
    }
  }
Replace the byte stored at position index in this stream with value

@param index which byte to replace
@param value the value to replace it with