Package com.github.jelmerk.knn.hnsw
Class JavaObjectSerializer<T>
- java.lang.Object
-
- com.github.jelmerk.knn.hnsw.JavaObjectSerializer<T>
-
- Type Parameters:
T
- type of object to serialize
- All Implemented Interfaces:
ObjectSerializer<T>
,Serializable
public class JavaObjectSerializer<T> extends Object implements ObjectSerializer<T>
Implementation ofObjectSerializer
that uses java serialization to write the value.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JavaObjectSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
read(ObjectInput in)
Reads an item from an ObjectOutput implementation.void
write(T item, ObjectOutput out)
Writes the item to an ObjectOutput implementation.
-
-
-
Method Detail
-
write
public void write(T item, ObjectOutput out) throws IOException
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
public T read(ObjectInput in) throws IOException, ClassNotFoundException
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
-
-