Whether the Java file is overwritten when it is written

Source: Internet
Author: User

This is with the server read data, is to write data to the server file, which encountered the question of whether to overwrite the previously written data, see FileWriter (), the parameter after the parameter called Append, with the dictionary is added meaning, brainwave, changed to false is not attached to it? Do not cover it, this does not have Baidu, oh two false solve our problems, hehe, the same blog post together to see a better understanding.

Try{
Writer w=NewFileWriter ("F://apache software foundation/tomcat 7.0/webapps/wxpay/code.txt",false);//The text written is not appended to the original but is overwritten directly
W.write (str);

W.close ();
}Catch(IOException e) {
//TODO auto-generated Catch block
System.out.println (E.getmessage ());
}

Whether the Java file is overwritten when it is written

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.