Generalized resource stream constructor.