process: abstract out HandleToStream
adopt @tjfountainex 's solution