code: protected void marshalStreamResult(Object graph, StreamResult streamResult)
  			throws XmlMappingException, IOException {
  
  		if (streamResult.getOutputStream() != null) {
  			marshalOutputStream(graph, streamResult.getOutputStream());
  		}
  		else if (streamResult.getWriter() != null) {
  			marshalWriter(graph, streamResult.getWriter());
  		}
  		else {
  			throw new IllegalArgumentException("StreamResult contains neither OutputStream nor Writer");
  		}
  	}
docs: Template method for handling {@code StreamResult}s.
  <p>This implementation delegates to {@code marshalOutputStream} or {@code marshalWriter},
  depending on what is contained in the {@code StreamResult}
  @param graph the root of the object graph to marshal
  @param streamResult the {@code StreamResult}
  @throws IOException if an I/O Exception occurs
  @throws XmlMappingException if the given object cannot be marshalled to the result
  @throws IllegalArgumentException if {@code streamResult} does neither
  contain an {@code OutputStream} nor a {@code Writer}