composing wrapped bytebuffers
Navgeet opened this issue · comments
ReadMe says wrapped bytebuffers are to be composed as
(compose-buffer my-spec :buffer (java.nio.ByteBuffer/allocate 14)
Reading the code suggest it should instead be
(compose-buffer my-spec :orig-buffer (java.nio.ByteBuffer/allocate 14)
Trying this out throws: No matching field found: wrappedBuffer for class java.nio.HeapByteBuffer
Thanks for reporting it. Would you like to submit a pull request?
Could do it, but I have no idea was clojurewerkz.buffy.core/set-writer-index does. It makes use of writerIndex method for a ByteBuffer, which doesn't seem to exist.
True. That's a method from ByteBuf from Netty... So we need to wrap a ByteBuffer into ByteBuf first, and set writer index only after that.
We need writer index mostly because otherwise Netty won't return correct buffer when writing back to socket for example