org.apache.directory.server.core.partition.impl.btree.jdbm
Class AttributeSerializer

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.jdbm.AttributeSerializer
All Implemented Interfaces:
java.io.Serializable, jdbm.helper.Serializer

public class AttributeSerializer
extends java.lang.Object
implements jdbm.helper.Serializer

Serializes a attributes object using a custom serialization mechanism so we do not have to rely on Java Serialization which is much more costly.

Version:
$Rev$, $Date$
Author:
Apache Directory Project
See Also:
Serialized Form

Constructor Summary
AttributeSerializer()
           
 
Method Summary
 java.lang.Object deserialize(byte[] buf)
          Deserializes an attribute from the custom serialization structure.
static org.apache.directory.server.core.partition.impl.btree.jdbm.AttributeSerializer.DeserializedAttribute deserialize(byte[] buf, int offset)
          Deserializes an attribute from the custom serialization structure.
 byte[] serialize(java.lang.Object obj)
          Serializes an attribute using the following structure: [id-length][id-bytes][is-binary][length0][value0]...[lengthN][valueN] Here the id-length is the 4 byte int value of the length of bytes for the id string bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeSerializer

public AttributeSerializer()
Method Detail

deserialize

public final java.lang.Object deserialize(byte[] buf)
                                   throws java.io.IOException
Deserializes an attribute from the custom serialization structure.

Specified by:
deserialize in interface jdbm.helper.Serializer
Throws:
java.io.IOException
See Also:
Serializer.deserialize(byte[])

deserialize

public static final org.apache.directory.server.core.partition.impl.btree.jdbm.AttributeSerializer.DeserializedAttribute deserialize(byte[] buf,
                                                                                                                                     int offset)
                                                                                                                              throws java.io.IOException
Deserializes an attribute from the custom serialization structure.

Throws:
java.io.IOException
See Also:
Serializer.deserialize(byte[])

serialize

public byte[] serialize(java.lang.Object obj)
                 throws java.io.IOException
Serializes an attribute using the following structure: [id-length][id-bytes][is-binary][length0][value0]...[lengthN][valueN] Here the id-length is the 4 byte int value of the length of bytes for the id string bytes. The id-bytes are the bytes for the id string. The is-binary byte is a true or false for whether or not the values are byte[] or String types. Following this is an array of length-value tuples for the values of the Attributes.

Specified by:
serialize in interface jdbm.helper.Serializer
Throws:
java.io.IOException


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