I was looking for information about the java.nio.ByteBuffer class and noticed that it has a lot of abstract methods. What confuses me is that you can create a ByteBuffer object by calling the static ByteBuffer.allocate or ByteBuffer.allocateDirect methods, and then use the abstract methods on this object. Erhm... how is that possible?
For example:
1 2 3 4
| ByteBuffer bb = ByteBuffer.allocateDirect(4); bb.putInt(10); System.out.println(bb.getInt(0)); |
Here's a link to the ByteBuffer reference:
http://java.sun.com/j2se/1.5.0/docs/api/java/nio/ByteBuffer.html