在例外发生时,可以使用例外对象的printStackTrace()显示堆栈追踪,如何改写以下程序,使得例外发生时,可将堆栈追踪附加至UTF-8编码的exception.log档案: package cc.openhome; import java.io.*; public class Exercise1 { public static void dump(InputStream src, OutputStream dest) throws IOException { try (InputStream input = src; OutputStream output = dest) { byte[] data = new byte[1024]; int length = -1; while ((length = input.read(data)) != -1) { output.write(data, 0, length); } } catch(IOException ex) { throw ex; } } }