Improve performance, fix buffer decoding
This commit is contained in:
parent
eba6ea4207
commit
615d87b4d5
@ -1,6 +1,7 @@
|
|||||||
package it.cavallium.vertx.rpcservice;
|
package it.cavallium.vertx.rpcservice;
|
||||||
|
|
||||||
import io.vertx.core.buffer.Buffer;
|
import io.vertx.core.buffer.Buffer;
|
||||||
|
import io.vertx.core.buffer.impl.BufferImpl;
|
||||||
import io.vertx.core.eventbus.MessageCodec;
|
import io.vertx.core.eventbus.MessageCodec;
|
||||||
import io.vertx.core.json.Json;
|
import io.vertx.core.json.Json;
|
||||||
|
|
||||||
@ -16,9 +17,10 @@ public record DataCodec<T>(MessageCodec<T, T> codec) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object decodeFromWire(int pos, Buffer buffer) {
|
public Object decodeFromWire(int pos, Buffer buffer) {
|
||||||
Buffer buf = Buffer.buffer();
|
int len = buffer.getInt(pos);
|
||||||
this.pos2 = buffer.readFromBuffer(pos, buf);
|
Buffer bufferData = buffer.getBuffer(pos + 4, pos + 4 + len);
|
||||||
return Json.decodeValue(buf);
|
this.pos2 = pos + 4 + len;
|
||||||
|
return Json.decodeValue(bufferData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPos2() {
|
public int getPos2() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user