Extracted SizedWriter to a sizedWriter struct with a Write() method.