Class Serializer

java.lang.Object
spark.serialization.Serializer
Direct Known Subclasses:
BytesSerializer, DefaultSerializer, InputStreamSerializer

public abstract class Serializer extends Object
Class that serializers and writes the result to given output stream.
  • Field Details

  • Constructor Details

    • Serializer

      public Serializer()
  • Method Details

    • setNext

      public void setNext(Serializer serializer)
      Sets the next serializer in the chain.
      Parameters:
      serializer - the next serializer.
    • processElement

      public void processElement(OutputStream outputStream, Object element) throws IOException
      Wraps process(java.io.OutputStream, Object) and calls next serializer in chain.
      Parameters:
      outputStream - the output stream.
      element - the element to process.
      Throws:
      IOException - IOException in case of IO error.
    • canProcess

      public abstract boolean canProcess(Object element)
      Checks if the serializer implementation can process the element type.
      Parameters:
      element - the element to process.
      Returns:
      true if the serializer can process the provided element.
    • process

      public abstract void process(OutputStream outputStream, Object element) throws IOException
      Processes the provided element and serializes to output stream.
      Parameters:
      outputStream - the output stream.
      element - the element.
      Throws:
      IOException - In the case of IO error.