changed interface, write and read are now abstract, instead of
delegating to writeImpl/readImpl