Add stream-based constructor.