请问用ObjectOutputStream和ObjectInputStream如何修改文件的部分内容? 如题所示,谢谢高手的帮助。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class eg extends Jframe implement ActionLister{ jtextArea text=new Jtextrea(10,10); Jbutton button=new Jbutton("保存"); String file="D:/you.txt"; public eg() { this.add(text,Borderlayout.center); this.add(button,Borderlayout.south); button.AddactionLister(this); myget();\\取文件里的内容 this.sevisable(true); this.setdefaultco.........(Jframe.Exitor...); } public void myget() { try { Objectinputstream oi=new Objectinputstream(new Fileinputstrame(file)); text.settext(oi.readObject().tostring()); oi.close(); } catch(Ex......... e) { } } 事件实现里这样写(A... e) { if(e.getActionCommon.equals("保存") { try { Objectoutputstream oo=new Objectoutputstream(new Fileoutputstrame(file)); oo.writerObject(text.gettext()); oo.close(); } catch(Ex......... e) {} } }} 请教System.out 的实现步骤 java 获取当前时间不正确 java删除xml子节点xml清空问题 怎么使JFRAME的叉子变灰呀 HashCodeBuilder的用法,有人知道吗?? 用ANT远程部署WEBLOGIC javaBean jar打包问题 HashMap中存的值有没有顺序的?如果有的话,怎么顺序的取得它的key值 截取字符串 几个简单问题 请问用ObjectOutputStream和ObjectInputStream如何修改文件的部分内容? JDBC连接SQLServer2000问题(怎么写就是不对,我已经打了sp4)
{
jtextArea text=new Jtextrea(10,10);
Jbutton button=new Jbutton("保存");
String file="D:/you.txt";
public eg()
{
this.add(text,Borderlayout.center);
this.add(button,Borderlayout.south);
button.AddactionLister(this);
myget();\\取文件里的内容
this.sevisable(true);
this.setdefaultco.........(Jframe.Exitor...);
}
public void myget()
{
try
{
Objectinputstream oi=new Objectinputstream(new Fileinputstrame(file));
text.settext(oi.readObject().tostring());
oi.close();
}
catch(Ex......... e)
{ }
}
事件实现里这样写(A... e)
{
if(e.getActionCommon.equals("保存")
{
try
{
Objectoutputstream oo=new Objectoutputstream(new Fileoutputstrame(file));
oo.writerObject(text.gettext());
oo.close();
}
catch(Ex......... e)
{}
}
}}