Implemented the basic buffer API.