📄 558630.xml
字号:
<?xml version='1.0' encoding='GB2312'?>
<?xml-stylesheet type='text/xsl' href='../csdn.xsl'?>
<Topic>
<Issue>
<PostUserNickName>反斗星</PostUserNickName>
<rank>二级(初级)</rank>
<ranknum>user2</ranknum>
<credit>110</credit>
<TopicId>558630</TopicId>
<TopicName>jsp如何新建文本文件?</TopicName>
<PostUserId>67984</PostUserId>
<PostUserName>otstar</PostUserName>
<RoomName>JSP</RoomName>
<ReplyNum>2</ReplyNum>
<PostDateTime>2002-3-6 15:17:04</PostDateTime>
<Point>20</Point>
<ReadNum>0</ReadNum>
<RoomId>28</RoomId>
<EndState>2</EndState>
<Content>程序打开一个文本文件,如果文件不存在的时候,可以新建一个特定文件名的文件,文件的内容从一个模板中获取!</Content>
</Issue>
<Replys>
<Reply>
<PostUserNickName>色子</PostUserNickName>
<rank>五级(中级)</rank>
<ranknum>user5</ranknum>
<credit>115</credit>
<ReplyID>3727908</ReplyID>
<TopicID>558630</TopicID>
<PostUserId>62789</PostUserId>
<PostUserName>zhjx_10</PostUserName>
<Point>20</Point>
<Content>File file = new File("test.txt");
if ( file.exit() ) {
	FileReader fr = new FileReader(file);
	//do something with fr
} else {
	try {
		file.createNewFile();
		FileReader mfr = new FileReader("test.mdl") // test.mdl is a model file
		String str = "";
		int c;
		while ( (c = mfr.read()) != -1 ) {
			str += (char)c;
		}
		mfr.close();
		FileWriter fw = new FileWriter(file);
		fr.write(str,0,str.length());
		fr.close();
	} catch ( Exception e ) {
	
	}
}
	
</Content>
<PostDateTime>2002-3-6 16:30:02</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>笨笨</PostUserNickName>
<rank>两星(中级)</rank>
<ranknum>star2</ranknum>
<credit>120</credit>
<ReplyID>3729856</ReplyID>
<TopicID>558630</TopicID>
<PostUserId>115764</PostUserId>
<PostUserName>yanchang</PostUserName>
<Point>0</Point>
<Content>ok</Content>
<PostDateTime>2002-3-6 18:26:51</PostDateTime>
</Reply>
</Replys>
</Topic>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -