< prev index next >
src/java.base/unix/classes/java/io/FileDescriptor.java
Print this page
@@ -57,20 +57,26 @@
* true, if file is opened for appending.
*/
private boolean append;
/**
+ * true, if file is opened with O_DIRECT flag;
+ */
+ private boolean direct;
+
+ /**
* Constructs an (invalid) FileDescriptor
* object.
*/
public FileDescriptor() {
fd = -1;
}
private FileDescriptor(int fd) {
this.fd = fd;
this.append = getAppend(fd);
+ this.direct = getDirect(fd);
}
/**
* A handle to the standard input stream. Usually, this file
* descriptor is not used directly, but rather via the input stream
@@ -163,10 +169,18 @@
public boolean getAppend(FileDescriptor obj) {
return obj.append;
}
+ public void setDirect(FileDescriptor obj, boolean direct) {
+ obj.direct = direct;
+ }
+
+ public boolean getDirect(FileDescriptor obj) {
+ return obj.direct;
+ }
+
public void setHandle(FileDescriptor obj, long handle) {
throw new UnsupportedOperationException();
}
public long getHandle(FileDescriptor obj) {
@@ -179,10 +193,15 @@
/**
* Returns true, if the file was opened for appending.
*/
private static native boolean getAppend(int fd);
+ /**
+ * Returns true, if the file was opened with O_DIRECT flag.
+ */
+ private native boolean getDirect(int fd);
+
/*
* Package private methods to track referents.
* If multiple streams point to the same FileDescriptor, we cycle
* through the list of all referents and call close()
*/
< prev index next >