This helps to encode directly when needed, e.g. for multipart stream with incremental delivery. See gh-959