บทความนี้อธิบายวิธีการของ Java โดยใช้รูปแบบ UTF8 เพื่อบันทึกไฟล์ข้อความ แบ่งปันสำหรับการอ้างอิงของคุณดังนี้:
FileOutputStream fos = null; outputStreamWriter writer = null; ลอง {ไฟล์ไฟล์ = ไฟล์ใหม่ (filepath); ทรัพยากร));} catch (Exception e) {checkxmlutil.adderRormsg (checkxmlutil.text_fomart_error, checkxmlutil.save_xml_fiall, e); } catch (ioexception e1) {checkxmlutil.adderRormsg (checkxmlutil.text_fomart_error, checkxmlutil.save_xml_fiall, e1);} ถ้า (นักเขียน! = null) checkxmlutilฉันหวังว่าบทความนี้จะเป็นประโยชน์กับการเขียนโปรแกรม Java ของทุกคน