private static void doRemoveBOM(@NotNull VirtualFile virtualFile, byte @NotNull [] bom) {
    virtualFile.setBOM(null);
    try {
      byte[] bytes = virtualFile.contentsToByteArray();
      byte[] contentWithStrippedBom = Arrays.copyOfRange(bytes, bom.length, bytes.length);
      WriteAction.runAndWait(() -> virtualFile.setBinaryContent(contentWithStrippedBom));
    }
    catch (IOException ex) {
      LOG.warn("Unexpected exception occurred on attempt to remove BOM from file " + virtualFile, ex);
    }
  }
private static void doRemoveBOM(@NotNull VirtualFile virtualFile, byte @NotNull [] bom)