Revert "put input stream on heap"

This reverts commit 7986068b7d4361a9f23c194c5090d2fcbef9f9ab.
Revert "cleanup based on feedback from @kkoppa"

This reverts commit 27ace892becdc94ad129c214341f043d3f98ca58.