/** * Creates a serializing content handler that writes to the given writer. * * @param writer serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(Writer writer) throws SAXException { return getSerializer(new StreamResult(writer)); }
/** * Creates a serializing content handler that writes to the given stream. * * @param output serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(OutputStream output) throws SAXException { return getSerializer(new StreamResult(output)); }
/** * Creates a serializing content handler that writes to the given writer. * * @param writer serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(Writer writer) throws SAXException { return getSerializer(new StreamResult(writer)); }
/** * Creates a serializing content handler that writes to the given writer. * * @param writer serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(Writer writer) throws SAXException { return getSerializer(new StreamResult(writer)); }
/** * Creates a serializing content handler that writes to the given stream. * * @param output serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(OutputStream output) throws SAXException { return getSerializer(new StreamResult(output)); }
/** * Creates a serializing content handler that writes to the given stream. * * @param output serialization target * @return serializing content handler * @throws SAXException if the content handler could not be initialized */ public static DefaultHandler getSerializer(OutputStream output) throws SAXException { return getSerializer(new StreamResult(output)); }
private void spoolMultiValued(OutputStream out) { try { Document doc = DomUtil.createDocument(); doc.appendChild(getProperty(JCR_VALUES).toXml(doc)); ContentHandler handler = SerializingContentHandler.getSerializer(out); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform( new DOMSource(doc), new SAXResult(handler)); } catch (SAXException e) { log.error("Failed to set up XML serializer for " + item, e); } catch (TransformerConfigurationException e) { log.error("Failed to set up XML transformer for " + item, e); } catch (ParserConfigurationException e) { log.error("Failed to set up XML document for " + item, e); } catch (TransformerException e) { log.error("Failed to serialize the values of " + item, e); } }
public WorkspaceContentHandler(Workspace workspace, String parentAbsPath, int uuidBehavior) throws RepositoryException { this.workspace = workspace; this.parentAbsPath = parentAbsPath; this.uuidBehavior = uuidBehavior; try { String tmpName = Text.md5(parentAbsPath); this.tmpFile = File.createTempFile("___" + tmpName, ".xml"); this.delegatee = SerializingContentHandler.getSerializer( new FileOutputStream(tmpFile)); } catch (FileNotFoundException e) { throw new RepositoryException(e); } catch (IOException e) { throw new RepositoryException(e); } catch (SAXException e) { throw new RepositoryException(e); } }
public WorkspaceContentHandler(Workspace workspace, String parentAbsPath, int uuidBehavior) throws RepositoryException { this.workspace = workspace; this.parentAbsPath = parentAbsPath; this.uuidBehavior = uuidBehavior; try { String tmpName = Text.md5(parentAbsPath); this.tmpFile = File.createTempFile("___" + tmpName, ".xml"); this.delegatee = SerializingContentHandler.getSerializer( new FileOutputStream(tmpFile)); } catch (FileNotFoundException e) { throw new RepositoryException(e); } catch (IOException e) { throw new RepositoryException(e); } catch (SAXException e) { throw new RepositoryException(e); } }