public static void write(@Nullable Project project,@NotNull VirtualFile virtualFile,@NotNull Object requestor,@NotNull String text,long newModificationStamp) throws IOException {
  Charset existing=virtualFile.getCharset();
  Pair.NonNull<Charset,byte[]> chosen=charsetForWriting(project,virtualFile,text,existing);
  Charset charset=chosen.first;
  byte[] buffer=chosen.second;
  if (!charset.equals(existing)) {
    virtualFile.setCharset(charset);
  }
  setDetectedFromBytesFlagBack(virtualFile,buffer);
  OutputStream outputStream=virtualFile.getOutputStream(requestor,newModificationStamp,-1);
  try {
    outputStream.write(buffer);
  }
  finally {
    outputStream.close();
  }
}

public static void write ( @ Nullable Project project , @ NotNull VirtualFile virtualFile , @ NotNull Object requestor , @ NotNull String text , long newModificationStamp ) throws IOException { Charset existing = virtualFile . getCharset ( ) ; Pair . NonNull < Charset , byte [ ] > chosen = charsetForWriting ( project , virtualFile , text , existing ) ; Charset charset = chosen . first ; byte [ ] buffer = chosen . second ; if ( ! charset . equals ( existing ) ) { virtualFile . setCharset ( charset ) ; } setDetectedFromBytesFlagBack ( virtualFile , buffer ) ; OutputStream outputStream = virtualFile . getOutputStream ( requestor , newModificationStamp , - 1 ) ; try { outputStream . write ( buffer ) ; } finally { outputStream . close ( ) ; } }
overwrites file with text and sets modification stamp and time stamp to the specified values . < p / > normally you should not use this method .
