Message-ID: <1893996240.31407.1408694876318.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_31406_570364343.1408694876318" ------=_Part_31406_570364343.1408694876318 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Groovy provides a number of helper methods<=
/a> for working with I/O. All of these work with standard Java Reader/Write=
r and InputStream/OutputStream and File and URL classes.
The use of c= losures allows resources to be processed ensuring that things are properly = closed irrespective of exceptions. e.g. to iterate through each line of a f= ile the following can be used...
If for whatever reason the println() method were to throw an ex= ception, the eachLine() method ensures that the file resource is c= orrectly closed. Similarly if an exception occurs while reading, the resour= ce will be closed too.=20
If you wish to use a reader/writer object or an input/output stream obje= ct there are helper methods to handle the resource for you via a closure - = which will automatically close down any resource if an exception occurs. e.= g.=20 =20