refactor, pull out helper class ByteArrayServletOutputStream