Package org.apache.storm.state

# Class DefaultStateSerializer<T>

java.lang.Object
org.apache.storm.state.DefaultStateSerializer<T>

All Implemented Interfaces:
  `Serializable`, `Serializer<T>`

public class DefaultStateSerializer<T> extends Object implements Serializer<T>
A default implementation that uses Kryo to serialize and de-serialize the state.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultStateSerializer()`
  `DefaultStateSerializer(Map<String,Object> topoConf, TopologyContext context)`
  `DefaultStateSerializer(Map<String,Object> topoConf, TopologyContext context, List<Class<?>> classesToRegister)`
  Constructs a `DefaultStateSerializer` instance with the given list of classes registered in kryo.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `deserialize(byte[] b)`
  `byte[]`
  `serialize(T obj)`

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

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

- ## Constructor Details

  - ### DefaultStateSerializer

    public DefaultStateSerializer(Map<String,Object> topoConf, TopologyContext context, List<Class<?>> classesToRegister)
    Constructs a `DefaultStateSerializer` instance with the given list of classes registered in kryo.
    Parameters:
      `classesToRegister` - the classes to register.

  - ### DefaultStateSerializer

    public DefaultStateSerializer(Map<String,Object> topoConf, TopologyContext context)

  - ### DefaultStateSerializer

    public DefaultStateSerializer()

- ## Method Details

  - ### serialize

    public byte[] serialize(T obj)
    Specified by:
      `serialize` in interface `Serializer<T>`

  - ### deserialize

    public T deserialize(byte[] b)
    Specified by:
      `deserialize` in interface `Serializer<T>`