Chapter 9. Leveraging Existing Native Libraries
One of the applications of the JNI is to write native methods that leverage code in existing native libraries. A typical approach, covered in this chapter, is to produce a class library that wraps a set of native functions.
This chapter first discusses the most straightforward way to write wrapper classes — one-to-one mapping. We then introduce a technique, shared stubs, that simplifies the task of writing wrapper classes.
One-to-one mapping and shared stubs are both techniques for wrapping native functions. At the end of this chapter, we will also discuss how to wrap native data structures using peer classes.
The approaches described in this chapter directly expose a native library using native methods, ...