## org.exist.dom
Class BinaryDocument

    java.lang.Object
      org.exist.dom.NodeImpl
          org.exist.dom.DocumentImpl
              org.exist.dom.BinaryDocument

All Implemented Interfaces:
  java.lang.Comparable, org.w3c.dom.Document, org.w3c.dom.Node, QNameable

public class BinaryDocument
extends DocumentImpl

Represents a binary resource. Binary resources are just stored as binary data in a single overflow page. However, class BinaryDocument extends `DocumentImpl` and thus provides the same interface.

Author:
  wolf

Field Summary

Fields inherited from class org.exist.dom.DocumentImpl
`BINARY_FILE, UNKNOWN_DOCUMENT_ID, XML_FILE`

Fields inherited from interface org.w3c.dom.Node
`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

Constructor Summary
`BinaryDocument(DBBroker broker)`
`BinaryDocument(DBBroker broker, Collection collection)`
`BinaryDocument(DBBroker broker, Collection collection, XmldbURI fileURI)`
`BinaryDocument(DBBroker broker, XmldbURI fileURI)`

Method Summary
`int` `getContentLength()` Returns the estimated size of the data in this document.
`long` `getPage()`
`byte` `getResourceType()` Returns the type of this resource, either `DocumentImpl.XML_FILE` or `DocumentImpl.BINARY_FILE`.
`void` `read(VariableByteInput istream)`
`void` `setContentLength(int length)`
`void` `setPage(long page)`
`void` `write(VariableByteOutputStream ostream)`

Methods inherited from class org.exist.dom.DocumentImpl

`adoptNode, appendChild, compareDocumentPosition, compareTo, copyChildren, copyOf, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getBaseURI, getBroker, getChildCount, getChildNodes, getCollection, getDocId, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getEncoding, getFeature, getFileURI, getFirstChild, getFirstChildAddress, getImplementation, getInputEncoding, getMetadata, getMetadataLocation, getNextSibling, getNode, getNode, getNodeType, getOwnerDocument, getParentNode, getPermissions, getPreviousSibling, getQName, getStandalone, getStrictErrorChecking, getSymbols, getTextContent, getUpdateLock, getURI, getUserData, getUserLock, getVersion, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertAfter, insertBefore, isDefaultNamespace, isEqualNode, isLockedForWrite, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalizeDocument, renameNode, setBroker, setChildCount, setCollection, setDocId, setDocumentType, setDocumentURI, setEncoding, setFileURI, setMetadata, setMetadataLocation, setOwnerDocument, setPermissions, setPermissions, setPermissions, setStandalone, setStrictErrorChecking, setTextContent, setUserData, setUserLock, setVersion, setXmlStandalone, setXmlVersion, toString, triggerDefrag, updateChild`

Methods inherited from class org.exist.dom.NodeImpl
`appendChild, appendChildren, cloneNode, getAttributes, getAttributesCount, getLastChild, getLocalName, getNamespaceURI, getNodeName, getNodeValue, getPrefix, hasAttributes, hasChildNodes, insertAfter, insertAfter, insertBefore, insertBefore, normalize, removeChild, removeChild, replaceChild, replaceChild, setAttributes, setNodeName, setNodeValue, setPrefix, supports, updateChild`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getAttributes, getLastChild, getLocalName, getNamespaceURI, getNodeName, getNodeValue, getPrefix, hasAttributes, hasChildNodes, insertBefore, normalize, removeChild, replaceChild, setNodeValue, setPrefix`

Constructor Detail

### BinaryDocument

    public BinaryDocument(DBBroker broker)

### BinaryDocument

    public BinaryDocument(DBBroker broker,
                          Collection collection)

### BinaryDocument

    public BinaryDocument(DBBroker broker,
                          XmldbURI fileURI)

### BinaryDocument

    public BinaryDocument(DBBroker broker,
                          Collection collection,
                          XmldbURI fileURI)

Method Detail

### getResourceType

    public byte getResourceType()

  Description copied from class: `DocumentImpl`
  Returns the type of this resource, either `DocumentImpl.XML_FILE` or `DocumentImpl.BINARY_FILE`.

  Overrides:
    `getResourceType` in class `DocumentImpl`

### setPage

    public void setPage(long page)

### getPage

    public long getPage()

### getContentLength

    public int getContentLength()

  Description copied from class: `DocumentImpl`
  Returns the estimated size of the data in this document. As an estimation, the number of pages occupied by the document is multiplied with the current page size.

  Overrides:
    `getContentLength` in class `DocumentImpl`

### setContentLength

    public void setContentLength(int length)

### write

    public void write(VariableByteOutputStream ostream)
               throws java.io.IOException

  Overrides:
    `write` in class `DocumentImpl`
  Throws:
    `java.io.IOException`

### read

    public void read(VariableByteInput istream)
              throws java.io.IOException,
                     java.io.EOFException

  Overrides:
    `read` in class `DocumentImpl`
  Throws:
    `java.io.IOException`
    `java.io.EOFException`

Copyright (C) Wolfgang Meier. All rights reserved.