今天在读FileInputStream类源代码时,发现在实现read()、available()、open()、skip()等方法时调用了外部实现。源代码如下:
public native int read() throws IOException;
public native long skip(long n) throws IOException;
public native int available() throws IOException;那么Java类库中是如何实现这些方法的?
public native int read() throws IOException;
public native long skip(long n) throws IOException;
public native int available() throws IOException;那么Java类库中是如何实现这些方法的?
C/C++ ?java实现不了这些底层?
楼主有兴趣可以去看看linux内核源码,里面有文件读写的具体实现