@SuppressWarnings("Duplicates")
  @NotNull
  protected static CharSequence loadCharContent(@NotNull File file, @Nullable String encoding) throws IOException {
    // FileUtil.loadText clones char array if length mismatch
    try (FileInputStream stream = new FileInputStream(file)) {
      try (Reader reader = encoding == null ? new InputStreamReader(stream) : new InputStreamReader(stream, encoding)) {
        // channel allows to avoid extra call to get file size because fd is reused, see Files.readAllBytes
        char[] chars = new char[(int)stream.getChannel().size()];
        int count = 0;
        while (count < chars.length) {
          int n = reader.read(chars, count, chars.length - count);
          if (n <= 0) {
            break;
          }
          count += n;
        }
        return CharBuffer.wrap(chars, 0, count);
      }
    }
  }
@SuppressWarnings("Duplicates")
  @NotNull
  protected static CharSequence loadCharContent(@NotNull File file, @Nullable String encoding)