org.apache.directory.mavibot.btree.serializer

## Interface Serializer<T>

- Type Parameters:
    `T` - The type for the element to serialize

      public interface Serializer<T>

  This interface is used by implementations of serializer, deserializr and comparator.
  Author:
    Apache Directory Project

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(T type1, T type2)` Returns the comparison of two types.
    `T` | `deserialize(BufferHandler bufferHandler)` Deserialize a type from a byte[]
    `byte[]` | `serialize(T type)` Produce the byte[] representation of the type

- - ### Method Detail

    - #### serialize

          byte[] serialize(T type)

      Produce the byte[] representation of the type
      Parameters:
        `type` - The type to serialize
      Returns:
        The byte[] containing the serialized type

    - #### deserialize

          T deserialize(BufferHandler bufferHandler)
                        throws IOException

      Deserialize a type from a byte[]
      Parameters:
        `bufferHandler` - The incoming BufferHandler
      Returns:
        The deserialized type
      Throws:
        `IOException` - If the deserialization failed

    - #### compare

          int compare(T type1,
                    T type2)

      Returns the comparison of two types.
      - If type1 < type2, return -1
      - If type1 > type2, return 1
      - If type1 == type2, return 0
      Parameters:
        `type1` - The first type to compare
        `type2` - The second type to compare
      Returns:
        The comparison result

Copyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.