java.nio.ByteBuffer is not extensible and this really sucks badly. I didn't realize that till today when I thought to write a custom ByteBuffer implementation and then realized that all the constructors had only package visibility.
The thing is that there are many good reasons why you would want a custom implementation of ByteBuffer . Maybe you want to proxy over another ByteBuffer for example; have an optimized view over a larger ByteBuffer to reduce data copying.
It seems that I was not the only one to feel this way. Check out http://forum.java.sun.com/thread.jspa?threadID=693259&messageID=4028590
It appears that not just a few people, but also whole frameworks like Apache MINA have gone ahead and constructed their own ByteBuffer replacements. Check out http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html which is extensible.