Implemented the read() and write() methods.