instantiating correct file stream depending on text datatype