Some sun.misc internal APIs are deprectaed in JDK 9 and will be encapsulated or removed in a future release.
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); int fd = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess() .get(randomAccessFile.getFD());
FileDescriptor fd = new FileDesciptor(); sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess().set(fd,3); FileInputStream fin = new FileInputStream(fd);
winHandle = LArrayNative.duplicateHandle(a.getHandle(raf.getFD()));
winHandle = LArrayNative.duplicateHandle(a.getHandle(raf.getFD()));
/** * Gets the real POSIX file descriptor for use by custom jni calls. */ private int getFileDescriptor() throws IOException { final int fd = SharedSecrets.getJavaIOFileDescriptorAccess().get(getFD()); if(fd < 1) throw new IOException("failed to get POSIX file descriptor!"); return fd; }
fdf.setAccessible(true); FileDescriptor fd = (FileDescriptor) fdf.get(s); int nativeFd = SharedSecrets.getJavaIOFileDescriptorAccess().get(fd); int localPort = (int) localPort0.invoke(dualStackPlainSocketImplClass, nativeFd); System.out.format("[local port=%s][exception=%s]\n", localPort, e.getMessage());