CavalliumDBEngine/src/main/java/it/cavallium/dbengine/lucene/DoubleCodec.java

18 lines
397 B
Java
Raw Normal View History

2021-10-15 22:03:53 +02:00
package it.cavallium.dbengine.lucene;
import io.net5.buffer.ByteBuf;
import java.util.function.Function;
public class DoubleCodec implements LMDBCodec<Double> {
@Override
public ByteBuf serialize(Function<Integer, ByteBuf> allocator, Double data) {
return allocator.apply(Double.BYTES).writeDouble(data);
}
@Override
public Double deserialize(ByteBuf b) {
return b.readDouble();
}
}