Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: How to write a struct into a file by appending method?


Message #1 by Edward <zhangsc@n...> on Tue, 18 Jun 2002 11:13:24 +0800
> I have a file error.txt,I want to append message into the file tail.I 
may get error.txt as OutputStream,like that:

OutputStream is = this.getClass().getResourceAsStream("error.txt");

I have a struct,it concludes:
1) Exception e
2) String errMsg
3) Date

I want to write e.printStackTrace(),errMsg and new Date() into this file 
by adopting append method.How to realize it?
Any idea will be appreciated!
Thanks in advance!!!
Edward

create such a method 
public void ( QutputStream is , Msg msg)
{
  is.write( msg.exception.toString());
  is.write( msg . errMsg );
  is.write( new Date()) ;  // not sure , it may changge to string first
}



  Return to Index