Package aQute.libg.sax.filters

Examples of aQute.libg.sax.filters.MergeContentFilter


    indexer.index(Collections.singleton(newFile.getCanonicalFile()), newIndexBuffer, null);
   
    // Merge into main index
    File tempIndex = File.createTempFile("repository", ".xml");
    FileOutputStream tempIndexOutput = new FileOutputStream(tempIndex);
    MergeContentFilter merger = new MergeContentFilter();
    XMLReader reader = SAXUtil.buildPipeline(new StreamResult(tempIndexOutput), new UniqueResourceFilter(), merger);
   
    try {
      // Parse the newly generated index
      reader.parse(new InputSource(new ByteArrayInputStream(newIndexBuffer.toByteArray())));
     
      // Parse the existing index (which may be empty/missing)
      try {
        reader.parse(new InputSource(new FileInputStream(localIndex)));
      } catch (Exception e) {
        reporter.warning("Existing local index is invalid or missing, overwriting (%s).", localIndex.getAbsolutePath());
      }
     
      merger.closeRootAndDocument();
    } finally {
      tempIndexOutput.flush();
      tempIndexOutput.close();
    }
    IO.copy(tempIndex, localIndex);
View Full Code Here

TOP

Related Classes of aQute.libg.sax.filters.MergeContentFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.