Package com.github.jelmerk.knn.hnsw
Interface ObjectSerializer<T>
-
- Type Parameters:
T
- type of object to serialize.
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
JavaObjectSerializer
public interface ObjectSerializer<T> extends Serializable
Implementations of this interface are used to customize how objects will be stored when the index is persisted
-
-
Method Summary
All Methods Instance Methods Abstract 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
void write(T item, ObjectOutput out) throws IOException
Writes the item to an ObjectOutput implementation.- Parameters:
item
- the item to writeout
- the ObjectOutput implementation to write to- Throws:
IOException
- in case of an I/O exception
-
read
T read(ObjectInput in) throws IOException, ClassNotFoundException
Reads an item from an ObjectOutput implementation.- 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
-
-