code: public int write(long pos, byte[] b, int off, int len) throws IOException {
      prepareForWrite(pos, len);
  
      if (len == 0) {
        return 0;
      }
  
      int remaining = len;
  
      int blockIndex = blockIndex(pos);
      byte[] block = blocks[blockIndex];
      int offInBlock = offsetInBlock(pos);
  
      int written = put(block, offInBlock, b, off, length(offInBlock, remaining));
      remaining -= written;
      off += written;
  
      while (remaining > 0) {
        block = blocks[++blockIndex];
  
        written = put(block, 0, b, off, length(remaining));
        remaining -= written;
        off += written;
      }
  
      long endPos = pos + len;
      if (endPos > size) {
        size = endPos;
      }
  
      return len;
    }
docs: Writes {@code len} bytes starting at offset {@code off} in the given byte array to this file
  starting at position {@code pos}. {@code pos} may be greater than the current size of this
  file, in which case this file is resized and all bytes between the current size and {@code pos}
  are set to 0. Returns the number of bytes written.
  
  @throws IOException if the file needs more blocks but the disk is full