public static @NotNull InputStream inputStreamSkippingBOM(@NotNull InputStream stream, @NotNull VirtualFile file) throws IOException {
    if (!stream.markSupported()) {
      //noinspection IOResourceOpenedButNotSafelyClosed
      stream = new BufferedInputStream(stream);
    }
    byte[] bom = CharsetToolkit.detectBOMFromStream(stream);
    if (bom != null && file.getBOM() == null) {
      // this method was called before com.intellij.openapi.fileEditor.impl.LoadTextUtil.detectCharsetAndSetBOM
      file.setBOM(bom);
    }
    return stream;
  }
public static @NotNull InputStream inputStreamSkippingBOM(@NotNull InputStream stream, @NotNull VirtualFile file)