abstract file writer to class