Package com.github.jelmerk.knn
Class JavaObjectSerializer<T>
java.lang.Object
com.github.jelmerk.knn.JavaObjectSerializer<T>
- Type Parameters:
T
- type of object to serialize
- All Implemented Interfaces:
ObjectSerializer<T>
,Serializable
Implementation of
ObjectSerializer
that uses java serialization to write the value.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionread
(ObjectInput in) Reads an item from an ObjectOutput implementation.void
write
(T item, ObjectOutput out) Writes the item to an ObjectOutput implementation.
-
Constructor Details
-
JavaObjectSerializer
public JavaObjectSerializer()
-
-
Method Details
-
write
Writes the item to an ObjectOutput implementation.- Specified by:
write
in interfaceObjectSerializer<T>
- Parameters:
item
- the item to writeout
- the ObjectOutput implementation to write to- Throws:
IOException
- in case of an I/O exception
-
read
Reads an item from an ObjectOutput implementation.- Specified by:
read
in interfaceObjectSerializer<T>
- Parameters:
in
- the ObjectInput implementation to read from- Returns:
- the read item
- Throws:
IOException
- in case of an I/O exceptionClassNotFoundException
- in case the value read does not match the type of item
-