Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.numbering
Interface NodeIdFactory

All Known Implementing Classes:
  DLNFactory

public interface NodeIdFactory

A factory for creating node ids. To support different numbering schemes, NodeId instances should always be created through this interface. The NodeIdFactory for the current database instance can be retrieved from `BrokerPool.getNodeFactory()`.

Method Summary
`NodeId` | `createFromData(int sizeHint, byte[] data, int startOffset)` Read a NodeId from the given byte array.
`NodeId` | `createFromStream(VariableByteInput is)` Read a NodeId from the given input stream.
`NodeId` | `createFromString(java.lang.String string)` Create a NodeId instance from its string representation.
`NodeId` | `createInstance()` Create a new NodeId, initialized with a default value.
`NodeId` | `createInstance(int id)` Create a new NodeId, initialized with the given base id.
`NodeId` | `documentNodeId()` Returns a NodeId representing the document node of a document.
`int` | `lengthInBytes(int units, byte[] data, int startOffset)` Returns the number of bytes occupied by the NodeId stored in the byte array at the given startOffset.
`void` | `writeEndOfDocument(VariableByteOutputStream os)`

Method Detail

### createInstance

    public NodeId createInstance()

  Create a new NodeId, initialized with a default value.

  Returns:
    a new NodeId.

### createInstance

    public NodeId createInstance(int id)

  Create a new NodeId, initialized with the given base id.

  Parameters:
    `id` -
  Returns:
    nodeId

### createFromStream

    public NodeId createFromStream(VariableByteInput is)
                            throws java.io.IOException

  Read a NodeId from the given input stream.

  Parameters:
    `is` - the input stream to read from
  Returns:
    the NodeId read
  Throws:
    `java.io.IOException`

### createFromData

    public NodeId createFromData(int sizeHint,
                                 byte[] data,
                                 int startOffset)

  Read a NodeId from the given byte array. Start to read at startOffset. sizeHint indicates the length of the id in an implementation dependent manner. Some implementations may require sizeHint to be specified, others not.

  Parameters:
    `sizeHint` - a hint about the expected length of the id
    `data` - the byte array to read from
    `startOffset` - offset into the byte array
  Returns:
    the NodeId read

### createFromString

    public NodeId createFromString(java.lang.String string)

  Create a NodeId instance from its string representation.

  Parameters:
    `string` - the string representation of the node id as returned by `Object.toString()`
  Returns:
    nodeId

### lengthInBytes

    public int lengthInBytes(int units,
                             byte[] data,
                             int startOffset)

  Returns the number of bytes occupied by the NodeId stored in the byte array at the given startOffset. This method is similar to `createFromData(int, byte[], int)`, but it just returns the number of bytes.

  Parameters:
    `units` -
    `data` -
    `startOffset` -
  Returns:
    number of bytes

### documentNodeId

    public NodeId documentNodeId()

  Returns a NodeId representing the document node of a document. Usually, this will be a singleton object.

  Returns:
    the document node id.

### writeEndOfDocument

    public void writeEndOfDocument(VariableByteOutputStream os)

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.