com.thinkaurelius.titan.graphdb.database.serialize

## Interface OrderPreservingSerializer<V>

- All Superinterfaces:
    AttributeHandler<V>, AttributeSerializer<V>
  All Known Implementing Classes:
    AbstractDecimal.AbstractDecimalSerializer, BooleanSerializer, ByteSerializer, CharacterSerializer, DateSerializer, Decimal.DecimalSerializer, IntegerSerializer, LongSerializer, Precision.PrecisionSerializer, ShortSerializer, StringSerializer

      public interface OrderPreservingSerializer<V>
      extends AttributeSerializer<V>

  Interface that extends `AttributeSerializer` to provide a serialization that is byte order preserving, i.e. the order of the elements (as given by its `Comparable` implementation) corresponds to the natural order of the serialized byte representation representation.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `V` | `readByteOrder(ScanBuffer buffer)` Reads an attribute from the given ReadBuffer assuming it was written in byte order.
    `void` | `writeByteOrder(WriteBuffer buffer, V attribute)` Writes the attribute value to the given WriteBuffer such that the byte order of the result is equal to the natural order of the attribute.

    - ### Methods inherited from interface com.thinkaurelius.titan.core.attribute.AttributeSerializer

      `read, write`

    - ### Methods inherited from interface com.thinkaurelius.titan.core.attribute.AttributeHandler

      `convert, verifyAttribute`

- - ### Method Detail

    - #### readByteOrder

          V readByteOrder(ScanBuffer buffer)

      Reads an attribute from the given ReadBuffer assuming it was written in byte order.

      It is expected that this read operation adjusts the position in the ReadBuffer to after the attribute value.
      Parameters:
        `buffer` - ReadBuffer to read attribute from
      Returns:
        Read attribute

    - #### writeByteOrder

          void writeByteOrder(WriteBuffer buffer,
                            V attribute)

      Writes the attribute value to the given WriteBuffer such that the byte order of the result is equal to the natural order of the attribute.

      It is expected that this write operation adjusts the position in the WriteBuffer to after the attribute value.
      Parameters:
        `buffer` - WriteBuffer to write attribute to
        `attribute` - Attribute to write to WriteBuffer

Copyright © 2012–2014. All rights reserved.