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

18 lines
401 B
Java
Raw Normal View History

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