For ENG-5865, fix up accounting of magic header space for use in Java