⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 558630.xml

📁 论坛精华帖子
💻 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&#32;file&#32;=&#32;new&#32;File("test.txt");
if&#32;(&#32;file.exit()&#32;)&#32;{
&#9;FileReader&#32;fr&#32;=&#32;new&#32;FileReader(file);
&#9;//do&#32;something&#32;with&#32;fr
}&#32;else&#32;{
&#9;try&#32;{
&#9;&#9;file.createNewFile();
&#9;&#9;FileReader&#32;mfr&#32;=&#32;new&#32;FileReader("test.mdl")&#32;//&#32;test.mdl&#32;is&#32;a&#32;model&#32;file
&#9;&#9;String&#32;str&#32;=&#32;"";
&#9;&#9;int&#32;c;
&#9;&#9;while&#32;(&#32;(c&#32;=&#32;mfr.read())&#32;!=&#32;-1&#32;)&#32;{
&#9;&#9;&#9;str&#32;+=&#32;(char)c;
&#9;&#9;}
&#9;&#9;mfr.close();
&#9;&#9;FileWriter&#32;fw&#32;=&#32;new&#32;FileWriter(file);
&#9;&#9;fr.write(str,0,str.length());
&#9;&#9;fr.close();
&#9;}&#32;catch&#32;(&#32;Exception&#32;e&#32;)&#32;{
&#9;
&#9;}
}
&#9;
</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 + -