I was looking at the Java code for FileInputStream and am interested in what the open and close methods do. These functions, or parts of them, are implemented natively. Do you know where I can find this code? Is this code part of the open source license for the JDK?
Native code is computer programming (code) that is compiled to run with a particular processor (such as an Intel x86-class processor) and its set of instructions. If the same program is run on a computer with a different processor, software can be provided so that the computer emulates the original processor.
LIB/MYLIB. LIB is the path that contains the native library you want to load using the System. loadLibrary() call, and myclass is the name of your Java application. For information about how a native library is located by the System.
The Java Native Interface (JNI) establishes a well-defined and platform-independent interface between the two. Native code can be used together with Java in two distinct ways: as "native methods" in a running JVM and as the code that creates a JVM using the "Invocation API".
http://java.sun.com/j2se/1.5.0/source_license.html http://download.java.net/jdk6/source/ http://openjdk.java.net/ http://www.gnu.org/software/classpath/
Here is a link to the FileInputStream code... there is also code specific to Windows and presumably other platforms inthe approriate directories.
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/0a5b87833562/src/share/native/java/io/FileInputStream.c
OpenJDK should have everything you search for, e.g. the Java 7 mercurial (hg) repository. A zip file with everything from Feb 21th is also available.
If you don't want the brand new developer stuff from Java 7, there is also everything for the well known Java 6.
The Sun source is available from java.net.
For FileInputStream, j2se/src/share/native/java/io/FileInputStream.c
. If you replace native
with windows
, solaris
or linux
there will be platform specific code in those directories. JDK7 has a slightly different structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With