This constructor is publicly available because it is used externally java.io.
Classes using new FileDescriptor()in JRE 7u4 Linux x86:
java.io.FileInputStream
java.io.FileOutputStream
java.io.RandomAccessFile
java.lang.UNIXProcess
java.net.AbstractPlainDatagramSocketImpl
java.net.AbstractPlainSocketImpl
java.net.ServerSocket
sun.net.sdp.SdpSupport
sun.nio.ch.FileChannelImpl
sun.nio.ch.FileDispatcherImpl
sun.nio.ch.IOUtil
sun.nio.ch.PipeImpl
sun.nio.ch.SctpServerChannelImpl
sun.nio.ch.ServerSocketChannelImpl
sun.nio.ch.UnixAsynchronousServerSocketChannelImpl
sun.nio.fs.UnixChannelFactory
There is a method sun.misc.SharedSecretsthat allows the programmer to change the state FileDescriptorto valid (this fragment is found in java.io.FileDescriptor):
static {
sun.misc.SharedSecrets.setJavaIOFileDescriptorAccess(
new sun.misc.JavaIOFileDescriptorAccess() {
public void set(FileDescriptor obj, int fd) {
obj.fd = fd;
}
public int get(FileDescriptor obj) {
return obj.fd;
}
public void setHandle(FileDescriptor obj, long handle) {
obj.handle = handle;
}
public long getHandle(FileDescriptor obj) {
return obj.handle;
}
}
);
}
, , SharedSecrets (I.E. JRE), FileDescriptor FileDescriptor(). , JRE, .