com.marklogic.xcc.types

## Interface XdmBinary

- All Superinterfaces:
    XdmItem, XdmNode, XdmValue

      public interface XdmBinary
      extends XdmNode

  An XDM-like binary() value (binary() is a MarkLogic extension).

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `asBinaryData()` Buffers the binary() item from the server and converts it to a Java byte array.

    - ### Methods inherited from interface com.marklogic.xcc.types.XdmNode

      `asW3cNode, asW3cNode`

    - ### Methods inherited from interface com.marklogic.xcc.types.XdmItem

      `asInputStream, asReader, getItemType, isCached, writeTo, writeTo`

    - ### Methods inherited from interface com.marklogic.xcc.types.XdmValue

      `asString, getValueType`

- - ### Method Detail

    - #### asBinaryData

          byte[] asBinaryData()

      Buffers the binary() item from the server and converts it to a Java byte array. This method may be invoked repeatedly. On subsequent invocations it will return the same array constructed by the first invocation.
      NOTE: If the binary() item is large, it is possible that an OutOfMemory error could result when invoking this method, which could result in your program crashing. If you need to handle arbitrarily large binary() items, use the `XdmItem.asInputStream()` method.
      Returns:
        This item as a Java byte array.
      Throws:
        `java.lang.IllegalStateException` - If called after the InputStream has already been consumed.
      See Also:
        `XdmItem.asInputStream()`, `XdmItem.isCached()`

Copyright © 2025 MarkLogic Corporation. All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com