hey! how i can create a bytepacketbuilder with custom capacity with ktor io?
a
Aleksei Tirman [JB]
11/15/2021, 9:12 AM
Could you please explain what do you mean by capacity?
g
Gabi
11/16/2021, 12:16 AM
the capacity in the buffer that is passed in the second parameter of BytePacketBuilder, and its default capacity is 4096, i am getting this error when i try to write 8192 bytes
a
Aleksei Tirman [JB]
11/16/2021, 7:54 AM
Could you please share a code snippet to reproduce
InsufficientSpaceException
?
Aleksei Tirman [JB]
11/16/2021, 7:59 AM
In the Ktor 2.0.0, you can instantiate the
DefaultBufferPool
and pass it to the constructor of `BytePacketBuilder`:
Copy code
val pool = DefaultBufferPool(bufferSize = 1024 * 1024)
val builder = BytePacketBuilder(0, pool)