this is sort of the opposite question to this question. if there is a low application POST
body size limit, say 8 KB, can we assume this request will be read as a single ByteBuffer
?
No.
NIO feeds the bytes as the network has them, and doesn't do any internal buffering of its own. The result is that we cannot assume we will get a read of a single specific size.
If this use-case is important to you, can I ask you to file a bug report on the repo? It's conceivably something we could add support for, potentially without requiring any buffering on at least some platforms.
it’s not really that important of a use-case, i was only wondering if i was duplicating work that NIO already does internally by copying to a new buffer. if there are no performance wins to be gained by re-using NIO’s buffer allocations, it is a lot easier to transfer everything to [UInt8]
, because things that don’t link NIO (like BSON decoders) can speak [UInt8]
.