encodeBuffer