text: 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();}