private void includeDisclaimer(File file, String disclaimer) throws ConfigException, IOException { String fileContent = FileUtils.readFileToString(file, brjs.bladerunnerConf().getDefaultFileCharacterEncoding()); FileUtils.writeStringToFile( file, disclaimer + fileContent, brjs.bladerunnerConf().getDefaultFileCharacterEncoding()); }
@Override public void writeContent(ParsedContentPath contentPath, BundleSet bundleSet, OutputStream os) throws ContentProcessingException { // TODO not parse the config on every execution XmlBundlerConfig config = new XmlBundlerConfig(brjs); XmlBundleWriter bundleWriter = new XmlBundleWriter(config); List<Asset> xmlAssets = bundleSet.getResourceFiles(xmlAssetPlugin); try { String outputEncoding = brjs.bladerunnerConf().getBrowserCharacterEncoding(); Writer output = new OutputStreamWriter(os, outputEncoding); if (config.isbundleConigAvailable()) { bundleWriter.writeBundle(xmlAssets, output); } else { bundleWriter.concatenateBundle(xmlAssets, output); } output.flush(); } catch (IOException | ConfigException | XMLStreamException e) { throw new ContentProcessingException(e, "Error while processing XML assets '"); } }