src/share/classes/java/io/RandomAccessFile.java
Print this page
rev 9260 : [mq]: io-events-path
@@ -60,10 +60,16 @@
private FileDescriptor fd;
private FileChannel channel = null;
private boolean rw;
+ /**
+ * The path of the referenced file
+ * (null if the stream is created with a file descriptor)
+ */
+ private final String path;
+
private Object closeLock = new Object();
private volatile boolean closed = false;
private static final int O_RDONLY = 1;
private static final int O_RDWR = 2;
@@ -231,10 +237,11 @@
if (file.isInvalid()) {
throw new FileNotFoundException("Invalid file path");
}
fd = new FileDescriptor();
fd.attach(this);
+ path = name;
open(name, imode);
}
/**
* Returns the opaque file descriptor object associated with this
@@ -270,11 +277,11 @@
* @spec JSR-51
*/
public final FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
- channel = FileChannelImpl.open(fd, true, rw, this);
+ channel = FileChannelImpl.open(fd, path, true, rw, this);
}
return channel;
}
}