Package com.saxonica.ee.extfn

## Class StreamFn

- java.lang.Object
- - net.sf.saxon.functions.AbstractFunction
  - - net.sf.saxon.functions.SystemFunction
    - - com.saxonica.ee.extfn.StreamFn

- All Implemented Interfaces:
    `Callable`, `Function`, `GroundedValue`, `Item`, `Sequence`

      public class StreamFn
      extends SystemFunction

  This class implements the saxon:stream() extension function.

  This is a pseudo-function which translates at compile time into a streaming copy instruction

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StreamFn()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Sequence` | `call​(XPathContext context, Sequence[] arguments)` | Evaluate this function call at run-time
    `Expression` | `makeFunctionCall​(Expression... arguments)` | Make an expression that either calls this function, or that is equivalent to a call on this function
    `Expression` | `makeOptimizedFunctionCall​(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments)` | Allow the function to create an optimized call based on the values of the actual arguments

    - ### Methods inherited from class net.sf.saxon.functions.SystemFunction

      `dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, importAttributes, isTrustedResultType, makeCall, makeFunction, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller`

    - ### Methods inherited from class net.sf.saxon.functions.AbstractFunction

      `atomize, deepEquals, effectiveBooleanValue, getAnnotations, getStringValue, getStringValueCS, isArray, isMap, makeNewContext, simplify, typeCheck`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.om.Function

      `getGenre`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `asIterable, concatenate, containsNode, materialize`

    - ### Methods inherited from interface net.sf.saxon.om.Item

      `getLength, head, isStreamed, itemAt, iterate, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `makeRepeatable`

- - ### Constructor Detail

    - #### StreamFn

          public StreamFn()

  - ### Method Detail

    - #### makeFunctionCall

          public Expression makeFunctionCall​(Expression... arguments)

      Make an expression that either calls this function, or that is equivalent to a call on this function
      Overrides:
        `makeFunctionCall` in class `SystemFunction`
      Parameters:
        `arguments` - the supplied arguments to the function call
      Returns:
        either a function call on this function, or an expression that delivers the same result

    - #### makeOptimizedFunctionCall

          public Expression makeOptimizedFunctionCall​(ExpressionVisitor visitor,
                                                      ContextItemStaticInfo contextInfo,
                                                      Expression... arguments)
                                               throws XPathException

      Allow the function to create an optimized call based on the values of the actual arguments
      Overrides:
        `makeOptimizedFunctionCall` in class `SystemFunction`
      Parameters:
        `visitor` - the expression visitor
        `contextInfo` - information about the context item
        `arguments` - the supplied arguments to the function call. Note: modifying the contents of this array should not be attempted, it is likely to have no effect.
      Returns:
        either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
      Throws:
        `XPathException` - if an error is detected

    - #### call

          public Sequence call​(XPathContext context,
                               Sequence[] arguments)
                        throws XPathException

      Evaluate this function call at run-time
      Parameters:
        `context` - The XPath dynamic evaluation context
        `arguments` - The values of the arguments to the function call. Each argument value (which is in general a sequence) is supplied in the form of an iterator over the items in the sequence. If required, the supplied sequence can be materialized by calling, for example, `new SequenceExtent(arguments[i])`. If the argument is always a singleton, then the single item may be obtained by calling `arguments[i].next()`. The implementation is not obliged to read all the items in each `SequenceIterator` if they are not required to compute the result; but if any SequenceIterator is not read to completion, it is good practice to call its close() method.
      Returns:
        an iterator over the results of the function. If the result is a single item, it can be returned in the form of a `SingletonIterator`. If the result is an empty sequence, the method should return `EmptyIterator.getInstance()`
      Throws:
        `XPathException` - if a dynamic error occurs during evaluation of the function. The Saxon run-time code will add information about the error location.