org.exist.numbering
Class DLNFactory

java.lang.Object
  extended byorg.exist.numbering.DLNFactory
All Implemented Interfaces:
NodeIdFactory

public class DLNFactory
extends java.lang.Object
implements NodeIdFactory

Implementation of NodeIdFactory for DLN-based node ids.


Constructor Summary
DLNFactory()
           
 
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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DLNFactory

public DLNFactory()
Method Detail

createInstance

public NodeId createInstance()
Description copied from interface: NodeIdFactory
Create a new NodeId, initialized with a default value.

Specified by:
createInstance in interface NodeIdFactory
Returns:
a new NodeId.

createInstance

public NodeId createInstance(int id)
Description copied from interface: NodeIdFactory
Create a new NodeId, initialized with the given base id.

Specified by:
createInstance in interface NodeIdFactory
Parameters:
id -
Returns:
nodeId

createFromStream

public NodeId createFromStream(VariableByteInput is)
                        throws java.io.IOException
Description copied from interface: NodeIdFactory
Read a NodeId from the given input stream.

Specified by:
createFromStream in interface NodeIdFactory
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)
Description copied from interface: NodeIdFactory
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.

Specified by:
createFromData in interface NodeIdFactory
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)
Description copied from interface: NodeIdFactory
Create a NodeId instance from its string representation.

Specified by:
createFromString in interface NodeIdFactory
Parameters:
string - the string representation of the node id as returned by Object.toString()
Returns:
nodeId

documentNodeId

public NodeId documentNodeId()
Description copied from interface: NodeIdFactory
Returns a NodeId representing the document node of a document. Usually, this will be a singleton object.

Specified by:
documentNodeId in interface NodeIdFactory
Returns:
the document node id.

lengthInBytes

public int lengthInBytes(int units,
                         byte[] data,
                         int startOffset)
Description copied from interface: NodeIdFactory
Returns the number of bytes occupied by the NodeId stored in the byte array at the given startOffset. This method is similar to NodeIdFactory.createFromData(int, byte[], int), but it just returns the number of bytes.

Specified by:
lengthInBytes in interface NodeIdFactory
Parameters:
units -
data -
startOffset -
Returns:
number of bytes

writeEndOfDocument

public void writeEndOfDocument(VariableByteOutputStream os)
Specified by:
writeEndOfDocument in interface NodeIdFactory


Copyright (C) Wolfgang Meier. All rights reserved.