private static @NotNull CharSequence nodeOf(@NotNull CharSequence node, int offset, int length) {
    if (length <= BLOCK_SIZE) {
      // Use toString to avoid referencing the original byte[] array in case if node is ByteArrayCharSequence
      return node.subSequence(offset, offset + length).toString();
    }
    // Splits on a block boundary.
    int half = ((length + BLOCK_SIZE) >> 1) & BLOCK_MASK;
    return new CompositeNode(nodeOf(node, offset, half), nodeOf(node, offset + half, length - half));
  }
private static @NotNull CharSequence nodeOf(@NotNull CharSequence node, int offset, int length)