AbstractMapWritable (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.io, class: AbstractMapWritable

Package org.apache.hadoop.io

# Class AbstractMapWritable

java.lang.Object
org.apache.hadoop.io.AbstractMapWritable

All Implemented Interfaces:
  `Configurable`, `Writable`

Direct Known Subclasses:
  `MapWritable`, `SortedMapWritable`

@Public @Stable public abstract class AbstractMapWritable extends Object implements Writable, Configurable
Abstract base class for MapWritable and SortedMapWritable Unlike org.apache.nutch.crawl.MapWritable, this class allows creation of MapWritable<Writable, MapWritable> so the CLASS_TO_ID and ID_TO_CLASS maps travel with the class instead of being static. Class ids range from 1 to 127 so there can be at most 127 distinct classes in any specific map instance.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractMapWritable()`
  constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `addToMap(Class<?> clazz)`
  Add a Class to the maps if it is not already present.
  `protected void`
  `copy(Writable other)`
  Used by child copy constructors.
  `protected Class<?>`
  `getClass(byte id)`
  the Class class for the specified id.
  `Configuration`
  `getConf()`
  Return the configuration used by this object.
  `protected byte`
  `getId(Class<?> clazz)`
  get id.
  `void`
  `readFields(DataInput in)`
  Deserialize the fields of this object from `in`.
  `void`
  `setConf(Configuration conf)`
  Set the configuration to be used by this object.
  `void`
  `write(DataOutput out)`
  Serialize the fields of this object to `out`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractMapWritable

    protected AbstractMapWritable()
    constructor.

- ## Method Details

  - ### addToMap

    protected void addToMap(Class<?> clazz)
    Add a Class to the maps if it is not already present.
    Parameters:
      `clazz` - clazz.

  - ### getClass

    protected Class<?> getClass(byte id)
    the Class class for the specified id.
    Parameters:
      `id` - id.
    Returns:
      the Class class for the specified id.

  - ### getId

    protected byte getId(Class<?> clazz)
    get id.
    Parameters:
      `clazz` - clazz.
    Returns:
      the id for the specified Class.

  - ### copy

    protected void copy(Writable other)
    Used by child copy constructors.
    Parameters:
      `other` - other.

  - ### getConf

    public Configuration getConf()
    Description copied from interface: `Configurable`
    Return the configuration used by this object.
    Specified by:
      `getConf` in interface `Configurable`
    Returns:
      the conf

  - ### setConf

    public void setConf(Configuration conf)
    Description copied from interface: `Configurable`
    Set the configuration to be used by this object.
    Specified by:
      `setConf` in interface `Configurable`
    Parameters:
      `conf` - the conf to set

  - ### write

    public void write(DataOutput out) throws IOException
    Description copied from interface: `Writable`
    Serialize the fields of this object to `out`.
    Specified by:
      `write` in interface `Writable`
    Parameters:
      `out` - `DataOuput` to serialize this object into.
    Throws:
      `IOException` - any other problem for write.

  - ### readFields

    public void readFields(DataInput in) throws IOException
    Description copied from interface: `Writable`
    Deserialize the fields of this object from `in`.

    For efficiency, implementations should attempt to re-use storage in the existing object where possible.

    Specified by:
      `readFields` in interface `Writable`
    Parameters:
      `in` - `DataInput` to deseriablize this object from.
    Throws:
      `IOException` - any other problem for readFields.