Code de-duplication in put() and putBytes().