Implement fromBuffer() and toBuffer().  Still needs testing.