如果查看库源代码,您将看到所有与低级API(OS等)的接口都是使用本机代码完成的.
例如,采取FileOutputStream:
/**
* Opens a file, with the specified name, for writing.
* @param name name of file to be opened
*/
private native void open(String name) throws FileNotFoundException;
/**
* Writes the specified byte to this file output stream. Implements
* the <code>write</code> method of <code>OutputStream</code>.
*
* @param b the byte to be written.
* @exception IOException if an I/O error occurs.
*/
public native void write(int b) throws IOException;
/**
* Writes a sub array as a sequence of bytes.
* @param b the data to be written
* @param off the start offset in the data
* @param len the number of bytes that are written
* @exception IOException If an I/O error has occurred.
*/
private native void writeBytes(byte b[], int off, int len) throws IOException;
Run Code Online (Sandbox Code Playgroud)
然后是相应的C文件(通常是特定于操作系统的).
| 归档时间: |
|
| 查看次数: |
973 次 |
| 最近记录: |