handle convert OuputStream and InputStream to and from domain object