org.apache.directory.server.core.avltree
Class ArrayMarshaller<E>

java.lang.Object
  extended by org.apache.directory.server.core.avltree.ArrayMarshaller<E>
All Implemented Interfaces:
Marshaller<ArrayTree<E>>

public class ArrayMarshaller<E>
extends java.lang.Object
implements Marshaller<ArrayTree<E>>

Class to serialize the Array data.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
ArrayMarshaller(java.util.Comparator<E> comparator)
          Creates a new instance of AvlTreeMarshaller with the default key Marshaller which uses Java Serialization.
ArrayMarshaller(java.util.Comparator<E> comparator, Marshaller<E> keyMarshaller)
          Creates a new instance of AvlTreeMarshaller with a custom key Marshaller.
 
Method Summary
 ArrayTree<E> deserialize(byte[] data)
          Creates an Array from given bytes of data.
 byte[] serialize(ArrayTree<E> tree)
          Marshals the given tree to bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayMarshaller

public ArrayMarshaller(java.util.Comparator<E> comparator,
                       Marshaller<E> keyMarshaller)
Creates a new instance of AvlTreeMarshaller with a custom key Marshaller.

Parameters:
comparator - Comparator to be used for key comparision
keyMarshaller - marshaller for keys

ArrayMarshaller

public ArrayMarshaller(java.util.Comparator<E> comparator)
Creates a new instance of AvlTreeMarshaller with the default key Marshaller which uses Java Serialization.

Parameters:
comparator - Comparator to be used for key comparision
Method Detail

serialize

public byte[] serialize(ArrayTree<E> tree)
Marshals the given tree to bytes

Specified by:
serialize in interface Marshaller<ArrayTree<E>>
Parameters:
tree - the tree to be marshalled

deserialize

public ArrayTree<E> deserialize(byte[] data)
                         throws java.io.IOException
Creates an Array from given bytes of data.

Specified by:
deserialize in interface Marshaller<ArrayTree<E>>
Parameters:
data - byte array to be converted into an array
Throws:
java.io.IOException


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.