--- old/src/share/classes/java/io/FileOutputStream.java 2012-11-02 19:24:25.000000000 +0100 +++ new/src/share/classes/java/io/FileOutputStream.java 2012-11-02 19:24:24.000000000 +0100 @@ -27,6 +27,7 @@ import java.nio.channels.FileChannel; import sun.nio.ch.FileChannelImpl; +import sun.misc.IoTrace; /** @@ -58,6 +59,11 @@ private final FileDescriptor fd; /** + * The path of the referenced file (null if there is no file) + */ + private final String path; + + /** * True if the file is opened for append. */ private final boolean append; @@ -199,7 +205,7 @@ this.fd = new FileDescriptor(); fd.attach(this); this.append = append; - + this.path = name; open(name, append); } @@ -235,6 +241,7 @@ security.checkWrite(fdObj); } this.fd = fdObj; + this.path = null; this.append = false; fd.attach(this); @@ -265,7 +272,9 @@ * @exception IOException if an I/O error occurs. */ public void write(int b) throws IOException { + Object traceHandle = IoTrace.fileWriteBegin(path); write(b, append); + IoTrace.fileWriteEnd(traceHandle, 1); } /** @@ -288,7 +297,9 @@ * @exception IOException if an I/O error occurs. */ public void write(byte b[]) throws IOException { + Object traceHandle = IoTrace.fileWriteBegin(path); writeBytes(b, 0, b.length, append); + IoTrace.fileWriteEnd(traceHandle, b.length); } /** @@ -301,7 +312,9 @@ * @exception IOException if an I/O error occurs. */ public void write(byte b[], int off, int len) throws IOException { + Object traceHandle = IoTrace.fileWriteBegin(path); writeBytes(b, off, len, append); + IoTrace.fileWriteEnd(traceHandle, len); } /** @@ -373,7 +386,7 @@ public FileChannel getChannel() { synchronized (this) { if (channel == null) { - channel = FileChannelImpl.open(fd, false, true, append, this); + channel = FileChannelImpl.open(fd, path, false, true, append, this); } return channel; }