tags:

views:

130

answers:

3

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?

+2  A: 

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.

Johannes Weiß
+6  A: 
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.

https://openjdk.dev.java.net/source/browse/openjdk/jdk/trunk/jdk/src/share/native/java/io/FileInputStream.c?rev=257&view=markup

TofuBeer
+2  A: 

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.

Tom Hawtin - tackline