extract writeInt method in KryoValueEncoder
@@ -50,13 +50,7 @@ public class KryoValueEncoder extends AbstractValueEncoder {
try {
if (useIdentityNumber) {
- output.writeByte(IDENTITY_NUMBER >>> 24);
- output.writeByte(IDENTITY_NUMBER >>> 16);
- output.writeByte(IDENTITY_NUMBER >>> 8);
- output.writeByte(IDENTITY_NUMBER);
-
- // kryo5 change writeInt to little endian
- // output.writeInt(IDENTITY_NUMBER);
+ writeInt(output, IDENTITY_NUMBER);
}
kryo.writeClassAndObject(output, value);
return output.toBytes();
@@ -74,4 +68,12 @@ public class KryoValueEncoder extends AbstractValueEncoder {
}
}
+ private void writeInt(Output output, int value) {
+ // kryo5 change writeInt to little endian, so we write int manually
+ output.writeByte(value >>> 24);
+ output.writeByte(value >>> 16);
+ output.writeByte(value >>> 8);
+ output.writeByte(value);
+ }
+
}
