src/share/classes/java/io/FileInputStream.java
Print this page
rev 9260 : imported patch io-events-path
*** 49,58 ****
--- 49,61 ----
class FileInputStream extends InputStream
{
/* File Descriptor - handle to the open file */
private final FileDescriptor fd;
+ /* The path of the referenced file (null if the stream is created with a file descriptor) */
+ private final String path;
+
private FileChannel channel = null;
private final Object closeLock = new Object();
private volatile boolean closed = false;
*** 126,135 ****
--- 129,139 ----
if (file.isInvalid()) {
throw new FileNotFoundException("Invalid file path");
}
fd = new FileDescriptor();
fd.attach(this);
+ path = name;
open(name);
}
/**
* Creates a <code>FileInputStream</code> by using the file descriptor
*** 162,171 ****
--- 166,176 ----
}
if (security != null) {
security.checkRead(fdObj);
}
fd = fdObj;
+ path = null;
/*
* FileDescriptor is being shared by streams.
* Register this stream with FileDescriptor tracker.
*/
*** 343,353 ****
* @spec JSR-51
*/
public FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
! channel = FileChannelImpl.open(fd, true, false, this);
}
return channel;
}
}
--- 348,358 ----
* @spec JSR-51
*/
public FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
! channel = FileChannelImpl.open(fd, path, true, false, this);
}
return channel;
}
}