reader and writer class