public void save() throws IOException {final byte[] out;final String text = toText();if (utf8Bom) {final ByteArrayOutputStream bos = new ByteArrayOutputStream();bos.write(0xEF);bos.write(0xBB);bos.write(0xBF);bos.write(text.getBytes(UTF_8));out = bos.toByteArray();} else {out = Constants.encode(text);}final LockFile lf = new LockFile(getFile());if (!lf.lock())throw new LockFailedException(getFile());try {lf.setNeedSnapshot(true);lf.write(out);if (!lf.commit())throw new IOException(MessageFormat.format(JGitText.get().cannotCommitWriteTo, getFile()));} finally {lf.unlock();}snapshot = lf.getCommitSnapshot();hash = hash(out);fireConfigChangedEvent();}

public override void Save(){byte[] @out;string text = ToText();if (utf8Bom){ByteArrayOutputStream bos = new ByteArrayOutputStream();bos.Write(unchecked((int)(0xEF)));bos.Write(unchecked((int)(0xBB)));bos.Write(unchecked((int)(0xBF)));bos.Write(Sharpen.Runtime.GetBytesForString(text, RawParseUtils.UTF8_CHARSET.Name()));@out = bos.ToByteArray();}else{@out = Constants.Encode(text);}LockFile lf = new LockFile(GetFile(), fs);if (!lf.Lock()){throw new LockFailedException(GetFile());}try{lf.SetNeedSnapshot(true);lf.Write(@out);if (!lf.Commit()){throw new IOException(MessageFormat.Format(JGitText.Get().cannotCommitWriteTo, GetFile()));}}finally{lf.Unlock();}snapshot = lf.GetCommitSnapshot();hash = Hash(@out);FireConfigChangedEvent();}
