Package spark.serialization
Class Serializer
- java.lang.Object
-
- spark.serialization.Serializer
-
- Direct Known Subclasses:
BytesSerializer
,DefaultSerializer
,InputStreamSerializer
public abstract class Serializer extends java.lang.Object
Class that serializers and writes the result to given output stream.
-
-
Field Summary
Fields Modifier and Type Field Description private Serializer
next
-
Constructor Summary
Constructors Constructor Description Serializer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
canProcess(java.lang.Object element)
Checks if the serializer implementation can process the element type.abstract void
process(java.io.OutputStream outputStream, java.lang.Object element)
Processes the provided element and serializes to output stream.void
processElement(java.io.OutputStream outputStream, java.lang.Object element)
Wrapsprocess(java.io.OutputStream, Object)
and calls next serializer in chain.void
setNext(Serializer serializer)
Sets the next serializer in the chain.
-
-
-
Field Detail
-
next
private Serializer next
-
-
Method Detail
-
setNext
public void setNext(Serializer serializer)
Sets the next serializer in the chain.- Parameters:
serializer
- the next serializer.
-
processElement
public void processElement(java.io.OutputStream outputStream, java.lang.Object element) throws java.io.IOException
Wrapsprocess(java.io.OutputStream, Object)
and calls next serializer in chain.- Parameters:
outputStream
- the output stream.element
- the element to process.- Throws:
java.io.IOException
- IOException in case of IO error.
-
canProcess
public abstract boolean canProcess(java.lang.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(java.io.OutputStream outputStream, java.lang.Object element) throws java.io.IOException
Processes the provided element and serializes to output stream.- Parameters:
outputStream
- the output stream.element
- the element.- Throws:
java.io.IOException
- In the case of IO error.
-
-