try-with-resources on arbitrary multiple files?

Wang Weijun at
Tue Apr 22 01:18:45 UTC 2014

If I copy a file to another I can

  try (src = open(ifile); dest = open(ofile)) {
    while (!src.EOF) dest.write(;

but what if there are multiple destinations? Is there something like

  try (src = open(ifile); manager = new CloseableManager()) {
    for (ofile: ofiles) {
    while (!src.EOF) {
      buffer =;
      for (dest: manager) dest.write(buffer);


More information about the compiler-dev mailing list