toByteArray

fun ByteBuf.toByteArray(): ByteArray

Reads the remaining contents of the ByteBuf into a byte array. This function will increase ByteBuf.writerIndex by ByteBuf.readableBytes