reader/writer: move common methods into base class
whitespace