implement calculatecontentlength