java - Is there a pattern for re-using a BufferedWriter? -


I am reading XML files from a directory (containing thousands of files), processing the content and for each input File to write an output file. Is there a way to re-point out an existing BufferedWriter rather than creating a new instance for each file?

  ... scanner scanner; Buffed Writer Writer; File outfile; (File f: for directory listing file []) (scanner = new scanner (f); outfile = ...; // processing input author = new buffed vitter (new flumerwriter (new file (outfile)); // Content Writer Type Flush (); writer.close ();} ...   

It looks like scanner and BufferedWriter .

It seems like a pre-adaptation to me Soft on the JVM Planet It is one of the best pieces of the software and can detect whether your objects are short-lived or not. This (and will also) can load a bottle of optimization. It is most likely that any micro- The result of optimization will be only in poor performance.

Remedy is for optimizing performance, not a reason.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -