So I've been working on a ByteSlab implementation which is similar to ChannelBuffer. The difference is that I use mmap() directly for files and Unsafe.allocateMemory directly.
This way I can have memory ranges > 2GB and the same thing for files as well as bypassing a TON of limitations in with ByteBuffer and Java's memory allocation bugs (which there are tons).
However, I realized that since Netty is always using ChannelBuffers the only way I can efficiently perform IO on large files is to take a slice < 2GB from a larger file and send it over the network.
Of course that makes a ton of sense since you really want to be thinking in packets and not GB of data.
However, ByteBuffer can't be efficiently instantiated since it's package private. I can't create a DirectByteBuffer easily.
So the only way I can think to do this is to implement the ChannelBuffer interface within my code. This API has a LOT of surface area.
I'm not sure there's an elegant way to bypass this.
I can't really pool implementations of ByteBuffer because I'm not sure when netty is done with them. And I generally don't like this approach ANYWAY.
I could create a new class that implements all the functionality of ChannelBuffer but that's a bit onerous of course. This will probably be the strategy I go with but it's going to add a lot of code.