Created an abstract stream serialization tool and transformed file
writing class to a daughter of this new abstract class.