Debian Codegraph @

net/sf/saxon/event/SequenceCopier.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.event;
9
10 import net.sf.saxon.om.Item;
11 import net.sf.saxon.om.SequenceIterator;
12 import net.sf.saxon.trans.XPathException;
13
14 /**
15 * Copies a sequence, supplied as a SequenceIterator, to a push pipeline, represented by
16 * a SequenceReceiver
17 */
18 public class SequenceCopier {
19
20 private SequenceCopier() {
21 }
22
23 /**
24 * Copy a sequence, supplied as a SequenceIterator, to a push pipeline, represented by
25 * a SequenceReceiver
26 * @param in an iterator over the input sequence
27 * @param out a Receiver to receive the output sequence. The method will open this receiver at the
28 * start and close it on completion.
29 * @throws XPathException if a failure occurs reading the input or writing the output
30 */
31
32 public static void copySequence(SequenceIterator<?> in, Receiver out) throws XPathException {
33 out.open();
34 in.forEachOrFail(out::append);
35 out.close();
36 }
37 }
38