Forum Discussion

LZhang's avatar
LZhang
Frequent Contributor
17 years ago

How to append data in existing file in groovy?

Hi:

Java can append data to a file using FileOutputStream or Filewriter.  Does groovy have a similar API? 


I found one of the threads that you posted previously which allowed us to save a soap response to an external file.  Again, I want to save multiple runs of the same request so I can capture ALL requests/responses (this is very important for me in debugging).

def msg = context.getProperty( "request-step#Response" )
new File( "testout.txt" ).write( msg )

Do you think it is possible using something similar to FileOutputStream/Filewriter to append all latter requests/responses to the first run?

Thanks,
Li Zhang