Generalizing file and stream read/write in APRIL-ANN