Search in sources :

Example 1 with XMLWriter

use of org.eclipse.rdf4j.common.xml.XMLWriter in project rdf4j by eclipse.

the class TransactionWriter method serialize.

/**
 * serialize the passed list of operations to the passed writer.
 *
 * @param txn
 *        the operations
 * @param out
 *        the output stream to write to
 * @throws IllegalArgumentException
 *         when one of the parameters is null
 */
public void serialize(Iterable<? extends TransactionOperation> txn, OutputStream out) throws IOException {
    assert txn != null : "operation list must not be null";
    assert out != null : "output stream must not be null";
    XMLWriter xmlWriter = new XMLWriter(out);
    xmlWriter.setPrettyPrint(true);
    xmlWriter.startDocument();
    xmlWriter.startTag(TransactionXMLConstants.TRANSACTION_TAG);
    for (TransactionOperation op : txn) {
        serialize(op, xmlWriter);
    }
    xmlWriter.endTag(TransactionXMLConstants.TRANSACTION_TAG);
    xmlWriter.endDocument();
}
Also used : TransactionOperation(org.eclipse.rdf4j.http.protocol.transaction.operations.TransactionOperation) XMLWriter(org.eclipse.rdf4j.common.xml.XMLWriter)

Aggregations

XMLWriter (org.eclipse.rdf4j.common.xml.XMLWriter)1 TransactionOperation (org.eclipse.rdf4j.http.protocol.transaction.operations.TransactionOperation)1