code: public static void save(CommandLine commandLine, Root root) {
  		if (commandLine.hasOption("dryrun")) {
  			return;
  		}
  
  		FileOutputStream fileOutputStream = null;
  		BufferedOutputStream bufferedOutputStream = null;
  		try {
  			JAXBContext contextObj = JAXBContext.newInstance(Root.class);
  
  			Marshaller marshaller = contextObj.createMarshaller();
  			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
  			if (commandLine.hasOption("docencoding")) {
  				marshaller.setProperty(Marshaller.JAXB_ENCODING, commandLine.getOptionValue("docencoding"));
  			}
  
  			String filename = "javadoc.xml";
  			if (commandLine.hasOption("filename")) {
  				filename = commandLine.getOptionValue("filename");
  			}
  			if (commandLine.hasOption("d")) {
  				filename = commandLine.getOptionValue("d") + File.separator + filename;
  			}
  
  			fileOutputStream = new FileOutputStream(filename);
  			bufferedOutputStream = new BufferedOutputStream(fileOutputStream, 1024 * 1024);
  
  			marshaller.marshal(root, bufferedOutputStream);
  			bufferedOutputStream.flush();
  			fileOutputStream.flush();
  
  		} catch (JAXBException e) {
  			log.error(e.getMessage(), e);
  		} catch (FileNotFoundException e) {
  			log.error(e.getMessage(), e);
  		} catch (IOException e) {
  			log.error(e.getMessage(), e);
  		} finally {
  			try {
  				if (bufferedOutputStream != null) {
  					bufferedOutputStream.close();
  				}
  				if (fileOutputStream != null) {
  					fileOutputStream.close();
  				}
  			} catch (IOException e) {
  				log.error(e.getMessage(), e);
  			}
  		}
  	}
docs: Save XML object model to a file via JAXB.
  
  @param commandLine
  the parsed command line arguments
  @param root
  the document root