Update Serializer.java and SerializerFixedBinaryLength.java

This commit is contained in:
Andrea Cavalli 2021-02-01 10:54:00 +01:00
parent 2bd69f0331
commit a949fcd1de
2 changed files with 7 additions and 7 deletions

View File

@ -2,13 +2,13 @@ package it.cavallium.dbengine.database.collections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public interface Serializer<B> { public interface Serializer<A, B> {
B deserialize(ByteBuf serialized); A deserialize(B serialized);
void serialize(B deserialized, ByteBuf output); void serialize(A deserialized, B output);
static Serializer<ByteBuf> noop() { static Serializer<ByteBuf, ByteBuf> noop() {
return new Serializer<>() { return new Serializer<>() {
@Override @Override
public ByteBuf deserialize(ByteBuf serialized) { public ByteBuf deserialize(ByteBuf serialized) {
@ -23,7 +23,7 @@ public interface Serializer<B> {
}; };
} }
static Serializer<byte[]> noopBytes() { static Serializer<byte[], ByteBuf> noopBytes() {
return new Serializer<>() { return new Serializer<>() {
@Override @Override
public byte[] deserialize(ByteBuf serialized) { public byte[] deserialize(ByteBuf serialized) {

View File

@ -2,11 +2,11 @@ package it.cavallium.dbengine.database.collections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public interface SerializerFixedBinaryLength<B> extends Serializer<B> { public interface SerializerFixedBinaryLength<A, B> extends Serializer<A, B> {
int getSerializedBinaryLength(); int getSerializedBinaryLength();
static SerializerFixedBinaryLength<ByteBuf> noop(int length) { static SerializerFixedBinaryLength<ByteBuf, ByteBuf> noop(int length) {
return new SerializerFixedBinaryLength<>() { return new SerializerFixedBinaryLength<>() {
@Override @Override
public ByteBuf deserialize(ByteBuf serialized) { public ByteBuf deserialize(ByteBuf serialized) {