INativeSerializer (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.mapred.nativetask.serde, interface: INativeSerializer

Package org.apache.hadoop.mapred.nativetask.serde

# Interface INativeSerializer<T>

All Known Implementing Classes:
  `DefaultSerializer`

@Public @Evolving public interface INativeSerializer<T>
an INativeSerializer serializes and deserializes data transferred between Java and native. `DefaultSerializer` provides default implementations. Note: if you implemented your customized NativeSerializer instead of DefaultSerializer, you have to make sure the native side can serialize it correctly.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `deserialize(DataInput in, int length, T w)`
  `int`
  `getLength(T w)`
  get length of data to be serialized.
  `void`
  `serialize(T w, DataOutput out)`

- ## Method Details

  - ### getLength

    int getLength(T w) throws IOException
    get length of data to be serialized. If the data length is already known (like IntWritable) and could immediately be returned from this method, it is good chance to implement customized NativeSerializer for efficiency
    Throws:
      `IOException`

  - ### serialize

    void serialize(T w, DataOutput out) throws IOException
    Throws:
      `IOException`

  - ### deserialize

    void deserialize(DataInput in, int length, T w) throws IOException
    Throws:
      `IOException`