Generalize file read.