move code for reading file contents to util class