org.apache.tinkerpop.gremlin.structure.io.binary

## Interface TypeSerializer<T>

- All Known Subinterfaces:
    CustomTypeSerializer<T>, TransformSerializer<T>
  All Known Implementing Classes:
    BigDecimalSerializer, BigIntegerSerializer, BindingSerializer, BulkSetSerializer, ByteBufferSerializer, ByteCodeSerializer, CharSerializer, ClassSerializer, DateSerializer, DurationSerializer, EdgeSerializer, EnumSerializer, GraphSerializer, InetAddressSerializer, InstantSerializer, LambdaSerializer, ListSerializer, LocalDateSerializer, LocalDateTimeSerializer, LocalTimeSerializer, MapEntrySerializer, MapSerializer, MetricsSerializer, MonthDaySerializer, OffsetDateTimeSerializer, OffsetTimeSerializer, PathSerializer, PeriodSerializer, PropertySerializer, PSerializer, SetSerializer, SimpleTypeSerializer, SingleTypeSerializer, StringSerializer, TraversalExplanationSerializer, TraversalMetricsSerializer, TraversalStrategySerializer, TraverserSerializer, TreeSerializer, UUIDSerializer, VertexPropertySerializer, VertexSerializer, YearMonthSerializer, ZonedDateTimeSerializer, ZoneOffsetSerializer

      public interface TypeSerializer<T>

  Represents a serializer for a given type.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataType` | `getDataType()` Gets the `DataType` that is represented by the given `T`.
    `T` | `read(Buffer buffer, GraphBinaryReader context)` Reads the type information and value from the buffer and returns an instance of T.
    `T` | `readValue(Buffer buffer, GraphBinaryReader context, boolean nullable)` Reads the value from the buffer (not the type information) and returns an instance of T.
    `void` | `write(T value, Buffer buffer, GraphBinaryWriter context)` Writes the type code, information and value to a buffer using the provided allocator.
    `void` | `writeValue(T value, Buffer buffer, GraphBinaryWriter context, boolean nullable)` Writes the value to a buffer, composed by the value flag and the sequence of bytes.

- - ### Method Detail

    - #### getDataType

          DataType getDataType()

      Gets the `DataType` that is represented by the given `T`.

    - #### read

          T read(Buffer buffer,
                 GraphBinaryReader context)
          throws IOException

      Reads the type information and value from the buffer and returns an instance of T.
      Throws:
        `IOException`

    - #### readValue

          T readValue(Buffer buffer,
                      GraphBinaryReader context,
                      boolean nullable)
               throws IOException

      Reads the value from the buffer (not the type information) and returns an instance of T.

      Implementors should throw an exception when a complex type doesn't support reading without the type information.

      Throws:
        `IOException`

    - #### write

          void write(T value,
                     Buffer buffer,
                     GraphBinaryWriter context)
              throws IOException

      Writes the type code, information and value to a buffer using the provided allocator.
      Throws:
        `IOException`

    - #### writeValue

          void writeValue(T value,
                          Buffer buffer,
                          GraphBinaryWriter context,
                          boolean nullable)
                   throws IOException

      Writes the value to a buffer, composed by the value flag and the sequence of bytes.
      Throws:
        `IOException`

Copyright © 2013–2022 Apache Software Foundation. All rights reserved.