how to write UTF8 data to xml file using RandomAccessFile?
问题 When trying to write some UTF8 data to a file, I end up with some garbage in the file. The code is as follows public static boolean saveToFile(StringBuffer buffer, String fileName, ArrayList exceptionList, String className) { log.debug("In saveToFile for file [" + fileName + "]"); RandomAccessFile raf = null; File file = new File(fileName); File backupFile = new File(fileName+"_bck"); try { if (file.exists()) { if (backupFile.exists()) { backupFile.delete(); } file.renameTo(backupFile); } raf