ref[protocol]: 重构protocol的JavaScript的解析

This commit is contained in:
jaysunxiao
2021-10-17 20:32:14 +08:00
parent a49cfbb902
commit e5e849f0a7
25 changed files with 356 additions and 357 deletions
@@ -50,7 +50,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeBooleanArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeBooleanArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -62,7 +62,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeBooleanBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeBooleanArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -74,7 +74,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeByteArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeByteArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -86,7 +86,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeByteBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeByteArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -98,7 +98,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeShortArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeShortArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -110,7 +110,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeShortBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeShortArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -122,7 +122,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -134,7 +134,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -146,7 +146,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -158,7 +158,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -170,7 +170,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeFloatArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeFloatArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -182,7 +182,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeFloatBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeFloatArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -194,7 +194,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeDoubleArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeDoubleArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -206,7 +206,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeDoubleBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeDoubleArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -218,7 +218,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -230,7 +230,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeCharArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeCharArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeCharArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -242,7 +242,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeCharBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeCharArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeCharArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -256,7 +256,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writePacketArray($1, {}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(objectProtocolField.getProtocolId())));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -284,7 +284,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readBooleanArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readBooleanArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break;
default:
flag = false;
@@ -296,7 +296,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readBooleanBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readBooleanArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break;
default:
flag = false;
@@ -308,7 +308,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readByteArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readByteArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break;
default:
flag = false;
@@ -320,7 +320,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readByteBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readByteArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break;
default:
flag = false;
@@ -332,7 +332,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readShortArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readShortArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break;
default:
flag = false;
@@ -344,7 +344,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readShortBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readShortArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break;
default:
flag = false;
@@ -356,7 +356,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readIntArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break;
default:
flag = false;
@@ -368,7 +368,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readIntBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break;
default:
flag = false;
@@ -380,7 +380,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readLongArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break;
default:
flag = false;
@@ -392,7 +392,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readLongBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break;
default:
flag = false;
@@ -404,7 +404,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readFloatArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readFloatArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break;
default:
flag = false;
@@ -416,7 +416,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readFloatBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readFloatArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break;
default:
flag = false;
@@ -428,7 +428,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readDoubleArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readDoubleArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break;
default:
flag = false;
@@ -440,7 +440,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readDoubleBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readDoubleArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break;
default:
flag = false;
@@ -452,7 +452,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readStringArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringArray();", array)).append(LS);
break;
default:
flag = false;
@@ -464,7 +464,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readCharArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readCharArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readCharArray();", array)).append(LS);
break;
default:
flag = false;
@@ -476,7 +476,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}[] {} = {}.readCharBoxArray($1);", arrayName, array, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readCharArray();", array)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readCharArray();", array)).append(LS);
break;
default:
flag = false;
@@ -488,7 +488,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
switch (language) {
// Java不支持泛型的数组初始化,这边就不做任何操作
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readPacketArray({});", array, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readPacketArray({});", array, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -47,7 +47,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeBooleanList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeBooleanArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -59,7 +59,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeByteList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeByteArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -71,7 +71,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeShortList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeShortArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -83,7 +83,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -95,7 +95,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -108,7 +108,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeFloatList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeFloatArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -121,7 +121,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeDoubleList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeDoubleArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -134,7 +134,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringList($1, (List){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -149,7 +149,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writePacketList($1, (List){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(objectProtocolField.getProtocolId())));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -175,7 +175,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readBooleanList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readBooleanArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", list)).append(LS);
break;
default:
flag = false;
@@ -187,7 +187,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readByteList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readByteArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readByteArray();", list)).append(LS);
break;
default:
flag = false;
@@ -199,7 +199,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readShortList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readShortArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readShortArray();", list)).append(LS);
break;
default:
flag = false;
@@ -211,7 +211,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readIntList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntArray();", list)).append(LS);
break;
default:
flag = false;
@@ -223,7 +223,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readLongList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongArray();", list)).append(LS);
break;
default:
flag = false;
@@ -235,7 +235,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readFloatList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readFloatArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", list)).append(LS);
break;
default:
flag = false;
@@ -247,7 +247,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readDoubleList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readDoubleArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", list)).append(LS);
break;
default:
flag = false;
@@ -259,7 +259,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readStringList($1);", list, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringArray();", list)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringArray();", list)).append(LS);
break;
default:
flag = false;
@@ -273,7 +273,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("List {} = {}.readPacketList($1, {});", list, EnhanceUtils.byteBufUtils, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(objectProtocolField.getProtocolId())));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readPacketArray({});", list, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readPacketArray({});", list, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -57,7 +57,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntIntMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntIntMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -66,7 +66,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntLongMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntLongMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -75,7 +75,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntStringMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntStringMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -84,7 +84,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return true;
}
}
@@ -95,7 +95,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongIntMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongIntMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -104,7 +104,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongLongMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writeLongLongMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return true;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -113,7 +113,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongStringMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongStringMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -122,7 +122,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return true;
}
}
@@ -133,7 +133,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringIntMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringIntMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringIntMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -142,7 +142,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringLongMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringLongMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringLongMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -151,7 +151,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringStringMap($1, (Map){});", EnhanceUtils.byteBufUtils, objectStr));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringStringMap({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringStringMap({});", objectStr)).append(LS);
return true;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -160,7 +160,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return true;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {});", objectStr, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return true;
}
}
@@ -187,7 +187,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readIntIntMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntIntMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntIntMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -196,7 +196,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readIntLongMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntLongMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntLongMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -205,7 +205,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readIntStringMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntStringMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntStringMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -214,7 +214,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readIntPacketMap($1, {});", map, EnhanceUtils.byteBufUtils, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return map;
}
}
@@ -225,7 +225,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readLongIntMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongIntMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongIntMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -234,7 +234,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readLongLongMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongLongMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongLongMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -243,7 +243,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readLongStringMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongStringMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongStringMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -252,7 +252,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readLongPacketMap($1, {});", map, EnhanceUtils.byteBufUtils, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return map;
}
}
@@ -263,7 +263,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readStringIntMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringIntMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringIntMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == LongSerializer.INSTANCE) {
@@ -272,7 +272,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readStringLongMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringLongMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringLongMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == StringSerializer.INSTANCE) {
@@ -281,7 +281,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readStringStringMap($1);", map, EnhanceUtils.byteBufUtils));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringStringMap();", map)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringStringMap();", map)).append(LS);
return map;
}
} else if (valueSerializer == ObjectProtocolSerializer.INSTANCE) {
@@ -290,7 +290,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Map {} = {}.readStringPacketMap($1, {});", map, EnhanceUtils.byteBufUtils, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(((ObjectProtocolField) valueRegistration).getProtocolId())));
return map;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringPacketMap({});", map, ((ObjectProtocolField) valueRegistration).getProtocolId())).append(LS);
return map;
}
}
@@ -48,7 +48,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeBooleanSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeBooleanArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeBooleanArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -60,7 +60,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeByteSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeByteArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeByteArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -72,7 +72,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeShortSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeShortArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeShortArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -84,7 +84,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeIntSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeIntArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeIntArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -96,7 +96,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeLongSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeLongArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLongArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -108,7 +108,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeFloatSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeFloatArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeFloatArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -120,7 +120,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeDoubleSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeDoubleArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeDoubleArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -132,7 +132,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writeStringSet($1, (Set){});", EnhanceUtils.byteBufUtils, objectStr));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writeStringArray({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeStringArray({});", objectStr)).append(LS);
break;
default:
flag = false;
@@ -147,7 +147,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("{}.writePacketSet($1, (Set){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(objectProtocolField.getProtocolId())));
break;
case JavaScript:
builder.append(StringUtils.format("byteBuffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writePacketArray({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -173,7 +173,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readBooleanSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readBooleanArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", set)).append(LS);
break;
default:
flag = false;
@@ -185,7 +185,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readByteSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readByteArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readByteArray();", set)).append(LS);
break;
default:
flag = false;
@@ -197,7 +197,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readShortSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readShortArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readShortArray();", set)).append(LS);
break;
default:
flag = false;
@@ -209,7 +209,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readIntSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readIntArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readIntArray();", set)).append(LS);
break;
default:
flag = false;
@@ -221,7 +221,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readLongSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readLongArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLongArray();", set)).append(LS);
break;
default:
flag = false;
@@ -233,7 +233,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readFloatSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readFloatArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", set)).append(LS);
break;
default:
flag = false;
@@ -245,7 +245,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readDoubleSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readDoubleArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", set)).append(LS);
break;
default:
flag = false;
@@ -257,7 +257,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readStringSet($1);", set, EnhanceUtils.byteBufUtils));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readStringArray();", set)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readStringArray();", set)).append(LS);
break;
default:
flag = false;
@@ -271,7 +271,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
builder.append(StringUtils.format("Set {} = {}.readPacketSet($1, {});", set, EnhanceUtils.byteBufUtils, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(objectProtocolField.getProtocolId())));
break;
case JavaScript:
builder.append(StringUtils.format("const {} = byteBuffer.readPacketArray({});", set, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readPacketArray({});", set, objectProtocolField.getProtocolId())).append(LS);
break;
default:
flag = false;
@@ -210,9 +210,9 @@ public abstract class GenerateJsUtils {
var protocolClazzName = registration.getConstructor().getDeclaringClass().getSimpleName();
var jsBuilder = new StringBuilder();
jsBuilder.append(StringUtils.format("{}.write = function(byteBuffer, packet) {", protocolClazzName)).append(LS);
jsBuilder.append(StringUtils.format("{}.write = function(buffer, packet) {", protocolClazzName)).append(LS);
jsBuilder.append(TAB).append("if (byteBuffer.writePacketFlag(packet)) {").append(LS);
jsBuilder.append(TAB).append("if (buffer.writePacketFlag(packet)) {").append(LS);
jsBuilder.append(TAB + TAB).append("return;").append(LS);
jsBuilder.append(TAB).append("}").append(LS);
@@ -234,8 +234,8 @@ public abstract class GenerateJsUtils {
var protocolClazzName = registration.getConstructor().getDeclaringClass().getSimpleName();
var jsBuilder = new StringBuilder();
jsBuilder.append(StringUtils.format("{}.read = function(byteBuffer) {", protocolClazzName)).append(LS);
jsBuilder.append(TAB).append("if (!byteBuffer.readBoolean()) {").append(LS);
jsBuilder.append(StringUtils.format("{}.read = function(buffer) {", protocolClazzName)).append(LS);
jsBuilder.append(TAB).append("if (!buffer.readBoolean()) {").append(LS);
jsBuilder.append(TAB + TAB).append("return null;").append(LS);
jsBuilder.append(TAB).append("}").append(LS);
@@ -42,12 +42,12 @@ public class JsArraySerializer implements IJsSerializer {
builder.append(StringUtils.format("if ({} === null) {", objectStr)).append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append("byteBuffer.writeInt(0);").append(LS);
builder.append("buffer.writeInt(0);").append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append("} else {").append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append(StringUtils.format("byteBuffer.writeInt({}.length);", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeInt({}.length);", objectStr)).append(LS);
String element = "element" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep + 1);
@@ -77,7 +77,7 @@ public class JsArraySerializer implements IJsSerializer {
String size = "size" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readInt();", size)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readInt();", size)).append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("if ({} > 0) {", size)).append(LS);
@@ -31,7 +31,7 @@ public class JsBooleanSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeBoolean({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeBoolean({});", objectStr)).append(LS);
}
@Override
@@ -39,7 +39,7 @@ public class JsBooleanSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readBoolean(); ", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readBoolean(); ", result)).append(LS);
return result;
}
}
@@ -31,7 +31,7 @@ public class JsByteSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeByte({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeByte({});", objectStr)).append(LS);
}
@Override
@@ -39,7 +39,7 @@ public class JsByteSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readByte();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readByte();", result)).append(LS);
return result;
}
}
@@ -30,14 +30,14 @@ public class JsCharSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeChar({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeChar({});", objectStr)).append(LS);
}
@Override
public String readObject(StringBuilder builder, int deep, Field field, IFieldRegistration fieldRegistration) {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readChar();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readChar();", result)).append(LS);
return result;
}
}
@@ -31,7 +31,7 @@ public class JsDoubleSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeDouble({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeDouble({});", objectStr)).append(LS);
}
@Override
@@ -39,7 +39,7 @@ public class JsDoubleSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readDouble();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readDouble();", result)).append(LS);
return result;
}
}
@@ -31,7 +31,7 @@ public class JsFloatSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeFloat({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeFloat({});", objectStr)).append(LS);
}
@Override
@@ -39,7 +39,7 @@ public class JsFloatSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readFloat();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readFloat();", result)).append(LS);
return result;
}
}
@@ -30,7 +30,7 @@ public class JsIntSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeInt({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeInt({});", objectStr)).append(LS);
}
@Override
@@ -38,7 +38,7 @@ public class JsIntSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readInt();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readInt();", result)).append(LS);
return result;
}
}
@@ -41,12 +41,12 @@ public class JsListSerializer implements IJsSerializer {
builder.append(StringUtils.format("if ({} === null) {", objectStr)).append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append("byteBuffer.writeInt(0);").append(LS);
builder.append("buffer.writeInt(0);").append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append("} else {").append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append(StringUtils.format("byteBuffer.writeInt({}.length);", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeInt({}.length);", objectStr)).append(LS);
String element = "element" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep + 1);
@@ -74,7 +74,7 @@ public class JsListSerializer implements IJsSerializer {
GenerateProtocolFile.addTab(builder, deep);
String size = "size" + GenerateProtocolFile.index.getAndIncrement();
builder.append(StringUtils.format("const {} = byteBuffer.readInt();", size)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readInt();", size)).append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("if ({} > 0) {", size)).append(LS);
@@ -30,7 +30,7 @@ public class JsLongSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeLong({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeLong({});", objectStr)).append(LS);
}
@Override
@@ -38,7 +38,7 @@ public class JsLongSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readLong();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readLong();", result)).append(LS);
return result;
}
}
@@ -40,13 +40,13 @@ public class JsMapSerializer implements IJsSerializer {
MapField mapField = (MapField) fieldRegistration;
builder.append(StringUtils.format("if ({} === null) {", objectStr)).append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append("byteBuffer.writeInt(0);").append(LS);
builder.append("buffer.writeInt(0);").append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append("} else {").append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append(StringUtils.format("byteBuffer.writeInt({}.size);", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeInt({}.size);", objectStr)).append(LS);
String key = "key" + GenerateProtocolFile.index.getAndIncrement();
String value = "value" + GenerateProtocolFile.index.getAndIncrement();
@@ -78,7 +78,7 @@ public class JsMapSerializer implements IJsSerializer {
GenerateProtocolFile.addTab(builder, deep);
String size = "size" + GenerateProtocolFile.index.getAndIncrement();
builder.append(StringUtils.format("const {} = byteBuffer.readInt();", size)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readInt();", size)).append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("if ({} > 0) {", size)).append(LS);
@@ -32,7 +32,7 @@ public class JsObjectProtocolSerializer implements IJsSerializer {
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
ObjectProtocolField objectProtocolField = (ObjectProtocolField) fieldRegistration;
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writePacket({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("buffer.writePacket({}, {});", objectStr, objectProtocolField.getProtocolId())).append(LS);
}
@Override
@@ -40,7 +40,7 @@ public class JsObjectProtocolSerializer implements IJsSerializer {
ObjectProtocolField objectProtocolField = (ObjectProtocolField) fieldRegistration;
var result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readPacket({});", result, objectProtocolField.getProtocolId())).append(LS);
builder.append(StringUtils.format("const {} = buffer.readPacket({});", result, objectProtocolField.getProtocolId())).append(LS);
return result;
}
}
@@ -41,13 +41,13 @@ public class JsSetSerializer implements IJsSerializer {
builder.append(StringUtils.format("if ({} === null) {", objectStr)).append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append("byteBuffer.writeInt(0);").append(LS);
builder.append("buffer.writeInt(0);").append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append("} else {").append(LS);
GenerateProtocolFile.addTab(builder, deep + 1);
builder.append(StringUtils.format("byteBuffer.writeInt({}.size);", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeInt({}.size);", objectStr)).append(LS);
String element = "element" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep + 1);
@@ -75,7 +75,7 @@ public class JsSetSerializer implements IJsSerializer {
GenerateProtocolFile.addTab(builder, deep);
String size = "size" + GenerateProtocolFile.index.getAndIncrement();
builder.append(StringUtils.format("const {} = byteBuffer.readInt();", size)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readInt();", size)).append(LS);
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("if ({} > 0) {", size)).append(LS);
@@ -31,7 +31,7 @@ public class JsShortSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeShort({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeShort({});", objectStr)).append(LS);
}
@Override
@@ -39,7 +39,7 @@ public class JsShortSerializer implements IJsSerializer {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readShort();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readShort();", result)).append(LS);
return result;
}
}
@@ -30,14 +30,14 @@ public class JsStringSerializer implements IJsSerializer {
@Override
public void writeObject(StringBuilder builder, String objectStr, int deep, Field field, IFieldRegistration fieldRegistration) {
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("byteBuffer.writeString({});", objectStr)).append(LS);
builder.append(StringUtils.format("buffer.writeString({});", objectStr)).append(LS);
}
@Override
public String readObject(StringBuilder builder, int deep, Field field, IFieldRegistration fieldRegistration) {
String result = "result" + GenerateProtocolFile.index.getAndIncrement();
GenerateProtocolFile.addTab(builder, deep);
builder.append(StringUtils.format("const {} = byteBuffer.readString();", result)).append(LS);
builder.append(StringUtils.format("const {} = buffer.readString();", result)).append(LS);
return result;
}
}
@@ -19,7 +19,6 @@ const minInt = -2147483648;
const util = require('util');
const encoder = new util.TextEncoder('utf-8');
const decoder = new util.TextDecoder('utf-8');
// 在js中long可以支持的最大值
// const maxLong = 9007199254740992;
// const minLong = -9007199254740992;
@@ -65,114 +65,114 @@ ComplexObject.prototype.protocolId = function() {
return 100;
};
ComplexObject.write = function(byteBuffer, packet) {
if (byteBuffer.writePacketFlag(packet)) {
ComplexObject.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
byteBuffer.writeByte(packet.a);
byteBuffer.writeByte(packet.aa);
byteBuffer.writeByteArray(packet.aaa);
byteBuffer.writeByteArray(packet.aaaa);
byteBuffer.writeShort(packet.b);
byteBuffer.writeShort(packet.bb);
byteBuffer.writeShortArray(packet.bbb);
byteBuffer.writeShortArray(packet.bbbb);
byteBuffer.writeInt(packet.c);
byteBuffer.writeInt(packet.cc);
byteBuffer.writeIntArray(packet.ccc);
byteBuffer.writeIntArray(packet.cccc);
byteBuffer.writeLong(packet.d);
byteBuffer.writeLong(packet.dd);
byteBuffer.writeLongArray(packet.ddd);
byteBuffer.writeLongArray(packet.dddd);
byteBuffer.writeFloat(packet.e);
byteBuffer.writeFloat(packet.ee);
byteBuffer.writeFloatArray(packet.eee);
byteBuffer.writeFloatArray(packet.eeee);
byteBuffer.writeDouble(packet.f);
byteBuffer.writeDouble(packet.ff);
byteBuffer.writeDoubleArray(packet.fff);
byteBuffer.writeDoubleArray(packet.ffff);
byteBuffer.writeBoolean(packet.g);
byteBuffer.writeBoolean(packet.gg);
byteBuffer.writeBooleanArray(packet.ggg);
byteBuffer.writeBooleanArray(packet.gggg);
byteBuffer.writeChar(packet.h);
byteBuffer.writeChar(packet.hh);
byteBuffer.writeCharArray(packet.hhh);
byteBuffer.writeCharArray(packet.hhhh);
byteBuffer.writeString(packet.jj);
byteBuffer.writeStringArray(packet.jjj);
byteBuffer.writePacket(packet.kk, 102);
byteBuffer.writePacketArray(packet.kkk, 102);
byteBuffer.writeIntArray(packet.l);
buffer.writeByte(packet.a);
buffer.writeByte(packet.aa);
buffer.writeByteArray(packet.aaa);
buffer.writeByteArray(packet.aaaa);
buffer.writeShort(packet.b);
buffer.writeShort(packet.bb);
buffer.writeShortArray(packet.bbb);
buffer.writeShortArray(packet.bbbb);
buffer.writeInt(packet.c);
buffer.writeInt(packet.cc);
buffer.writeIntArray(packet.ccc);
buffer.writeIntArray(packet.cccc);
buffer.writeLong(packet.d);
buffer.writeLong(packet.dd);
buffer.writeLongArray(packet.ddd);
buffer.writeLongArray(packet.dddd);
buffer.writeFloat(packet.e);
buffer.writeFloat(packet.ee);
buffer.writeFloatArray(packet.eee);
buffer.writeFloatArray(packet.eeee);
buffer.writeDouble(packet.f);
buffer.writeDouble(packet.ff);
buffer.writeDoubleArray(packet.fff);
buffer.writeDoubleArray(packet.ffff);
buffer.writeBoolean(packet.g);
buffer.writeBoolean(packet.gg);
buffer.writeBooleanArray(packet.ggg);
buffer.writeBooleanArray(packet.gggg);
buffer.writeChar(packet.h);
buffer.writeChar(packet.hh);
buffer.writeCharArray(packet.hhh);
buffer.writeCharArray(packet.hhhh);
buffer.writeString(packet.jj);
buffer.writeStringArray(packet.jjj);
buffer.writePacket(packet.kk, 102);
buffer.writePacketArray(packet.kkk, 102);
buffer.writeIntArray(packet.l);
if (packet.ll === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.ll.length);
buffer.writeInt(packet.ll.length);
packet.ll.forEach(element0 => {
if (element0 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(element0.length);
buffer.writeInt(element0.length);
element0.forEach(element1 => {
byteBuffer.writeIntArray(element1);
buffer.writeIntArray(element1);
});
}
});
}
if (packet.lll === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.lll.length);
buffer.writeInt(packet.lll.length);
packet.lll.forEach(element2 => {
byteBuffer.writePacketArray(element2, 102);
buffer.writePacketArray(element2, 102);
});
}
byteBuffer.writeStringArray(packet.llll);
buffer.writeStringArray(packet.llll);
if (packet.lllll === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.lllll.length);
buffer.writeInt(packet.lllll.length);
packet.lllll.forEach(element3 => {
byteBuffer.writeIntStringMap(element3);
buffer.writeIntStringMap(element3);
});
}
byteBuffer.writeIntStringMap(packet.m);
byteBuffer.writeIntPacketMap(packet.mm, 102);
buffer.writeIntStringMap(packet.m);
buffer.writeIntPacketMap(packet.mm, 102);
if (packet.mmm === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.mmm.size);
buffer.writeInt(packet.mmm.size);
packet.mmm.forEach((value5, key4) => {
byteBuffer.writePacket(key4, 102);
byteBuffer.writeIntArray(value5);
buffer.writePacket(key4, 102);
buffer.writeIntArray(value5);
});
}
if (packet.mmmm === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.mmmm.size);
buffer.writeInt(packet.mmmm.size);
packet.mmmm.forEach((value7, key6) => {
if (key6 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(key6.length);
buffer.writeInt(key6.length);
key6.forEach(element8 => {
byteBuffer.writePacketArray(element8, 102);
buffer.writePacketArray(element8, 102);
});
}
if (value7 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(value7.length);
buffer.writeInt(value7.length);
value7.forEach(element9 => {
if (element9 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(element9.length);
buffer.writeInt(element9.length);
element9.forEach(element10 => {
byteBuffer.writeIntArray(element10);
buffer.writeIntArray(element10);
});
}
});
@@ -180,151 +180,151 @@ ComplexObject.write = function(byteBuffer, packet) {
});
}
if (packet.mmmmm === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.mmmmm.size);
buffer.writeInt(packet.mmmmm.size);
packet.mmmmm.forEach((value12, key11) => {
if (key11 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(key11.length);
buffer.writeInt(key11.length);
key11.forEach(element13 => {
byteBuffer.writeIntStringMap(element13);
buffer.writeIntStringMap(element13);
});
}
if (value12 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(value12.size);
buffer.writeInt(value12.size);
value12.forEach(element14 => {
byteBuffer.writeIntStringMap(element14);
buffer.writeIntStringMap(element14);
});
}
});
}
byteBuffer.writeIntArray(packet.s);
buffer.writeIntArray(packet.s);
if (packet.ss === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.ss.size);
buffer.writeInt(packet.ss.size);
packet.ss.forEach(element15 => {
if (element15 === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(element15.size);
buffer.writeInt(element15.size);
element15.forEach(element16 => {
byteBuffer.writeIntArray(element16);
buffer.writeIntArray(element16);
});
}
});
}
if (packet.sss === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.sss.size);
buffer.writeInt(packet.sss.size);
packet.sss.forEach(element17 => {
byteBuffer.writePacketArray(element17, 102);
buffer.writePacketArray(element17, 102);
});
}
byteBuffer.writeStringArray(packet.ssss);
buffer.writeStringArray(packet.ssss);
if (packet.sssss === null) {
byteBuffer.writeInt(0);
buffer.writeInt(0);
} else {
byteBuffer.writeInt(packet.sssss.size);
buffer.writeInt(packet.sssss.size);
packet.sssss.forEach(element18 => {
byteBuffer.writeIntStringMap(element18);
buffer.writeIntStringMap(element18);
});
}
};
ComplexObject.read = function(byteBuffer) {
if (!byteBuffer.readBoolean()) {
ComplexObject.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new ComplexObject();
const result19 = byteBuffer.readByte();
const result19 = buffer.readByte();
packet.a = result19;
const result20 = byteBuffer.readByte();
const result20 = buffer.readByte();
packet.aa = result20;
const array21 = byteBuffer.readByteArray();
const array21 = buffer.readByteArray();
packet.aaa = array21;
const array22 = byteBuffer.readByteArray();
const array22 = buffer.readByteArray();
packet.aaaa = array22;
const result23 = byteBuffer.readShort();
const result23 = buffer.readShort();
packet.b = result23;
const result24 = byteBuffer.readShort();
const result24 = buffer.readShort();
packet.bb = result24;
const array25 = byteBuffer.readShortArray();
const array25 = buffer.readShortArray();
packet.bbb = array25;
const array26 = byteBuffer.readShortArray();
const array26 = buffer.readShortArray();
packet.bbbb = array26;
const result27 = byteBuffer.readInt();
const result27 = buffer.readInt();
packet.c = result27;
const result28 = byteBuffer.readInt();
const result28 = buffer.readInt();
packet.cc = result28;
const array29 = byteBuffer.readIntArray();
const array29 = buffer.readIntArray();
packet.ccc = array29;
const array30 = byteBuffer.readIntArray();
const array30 = buffer.readIntArray();
packet.cccc = array30;
const result31 = byteBuffer.readLong();
const result31 = buffer.readLong();
packet.d = result31;
const result32 = byteBuffer.readLong();
const result32 = buffer.readLong();
packet.dd = result32;
const array33 = byteBuffer.readLongArray();
const array33 = buffer.readLongArray();
packet.ddd = array33;
const array34 = byteBuffer.readLongArray();
const array34 = buffer.readLongArray();
packet.dddd = array34;
const result35 = byteBuffer.readFloat();
const result35 = buffer.readFloat();
packet.e = result35;
const result36 = byteBuffer.readFloat();
const result36 = buffer.readFloat();
packet.ee = result36;
const array37 = byteBuffer.readFloatArray();
const array37 = buffer.readFloatArray();
packet.eee = array37;
const array38 = byteBuffer.readFloatArray();
const array38 = buffer.readFloatArray();
packet.eeee = array38;
const result39 = byteBuffer.readDouble();
const result39 = buffer.readDouble();
packet.f = result39;
const result40 = byteBuffer.readDouble();
const result40 = buffer.readDouble();
packet.ff = result40;
const array41 = byteBuffer.readDoubleArray();
const array41 = buffer.readDoubleArray();
packet.fff = array41;
const array42 = byteBuffer.readDoubleArray();
const array42 = buffer.readDoubleArray();
packet.ffff = array42;
const result43 = byteBuffer.readBoolean();
const result43 = buffer.readBoolean();
packet.g = result43;
const result44 = byteBuffer.readBoolean();
const result44 = buffer.readBoolean();
packet.gg = result44;
const array45 = byteBuffer.readBooleanArray();
const array45 = buffer.readBooleanArray();
packet.ggg = array45;
const array46 = byteBuffer.readBooleanArray();
const array46 = buffer.readBooleanArray();
packet.gggg = array46;
const result47 = byteBuffer.readChar();
const result47 = buffer.readChar();
packet.h = result47;
const result48 = byteBuffer.readChar();
const result48 = buffer.readChar();
packet.hh = result48;
const array49 = byteBuffer.readCharArray();
const array49 = buffer.readCharArray();
packet.hhh = array49;
const array50 = byteBuffer.readCharArray();
const array50 = buffer.readCharArray();
packet.hhhh = array50;
const result51 = byteBuffer.readString();
const result51 = buffer.readString();
packet.jj = result51;
const array52 = byteBuffer.readStringArray();
const array52 = buffer.readStringArray();
packet.jjj = array52;
const result53 = byteBuffer.readPacket(102);
const result53 = buffer.readPacket(102);
packet.kk = result53;
const array54 = byteBuffer.readPacketArray(102);
const array54 = buffer.readPacketArray(102);
packet.kkk = array54;
const list55 = byteBuffer.readIntArray();
const list55 = buffer.readIntArray();
packet.l = list55;
const result56 = [];
const size57 = byteBuffer.readInt();
const size57 = buffer.readInt();
if (size57 > 0) {
for (let index58 = 0; index58 < size57; index58++) {
const result59 = [];
const size60 = byteBuffer.readInt();
const size60 = buffer.readInt();
if (size60 > 0) {
for (let index61 = 0; index61 < size60; index61++) {
const list62 = byteBuffer.readIntArray();
const list62 = buffer.readIntArray();
result59.push(list62);
}
}
@@ -333,60 +333,60 @@ ComplexObject.read = function(byteBuffer) {
}
packet.ll = result56;
const result63 = [];
const size64 = byteBuffer.readInt();
const size64 = buffer.readInt();
if (size64 > 0) {
for (let index65 = 0; index65 < size64; index65++) {
const list66 = byteBuffer.readPacketArray(102);
const list66 = buffer.readPacketArray(102);
result63.push(list66);
}
}
packet.lll = result63;
const list67 = byteBuffer.readStringArray();
const list67 = buffer.readStringArray();
packet.llll = list67;
const result68 = [];
const size69 = byteBuffer.readInt();
const size69 = buffer.readInt();
if (size69 > 0) {
for (let index70 = 0; index70 < size69; index70++) {
const map71 = byteBuffer.readIntStringMap();
const map71 = buffer.readIntStringMap();
result68.push(map71);
}
}
packet.lllll = result68;
const map72 = byteBuffer.readIntStringMap();
const map72 = buffer.readIntStringMap();
packet.m = map72;
const map73 = byteBuffer.readIntPacketMap(102);
const map73 = buffer.readIntPacketMap(102);
packet.mm = map73;
const result74 = new Map();
const size75 = byteBuffer.readInt();
const size75 = buffer.readInt();
if (size75 > 0) {
for (let index76 = 0; index76 < size75; index76++) {
const result77 = byteBuffer.readPacket(102);
const list78 = byteBuffer.readIntArray();
const result77 = buffer.readPacket(102);
const list78 = buffer.readIntArray();
result74.set(result77, list78);
}
}
packet.mmm = result74;
const result79 = new Map();
const size80 = byteBuffer.readInt();
const size80 = buffer.readInt();
if (size80 > 0) {
for (let index81 = 0; index81 < size80; index81++) {
const result82 = [];
const size83 = byteBuffer.readInt();
const size83 = buffer.readInt();
if (size83 > 0) {
for (let index84 = 0; index84 < size83; index84++) {
const list85 = byteBuffer.readPacketArray(102);
const list85 = buffer.readPacketArray(102);
result82.push(list85);
}
}
const result86 = [];
const size87 = byteBuffer.readInt();
const size87 = buffer.readInt();
if (size87 > 0) {
for (let index88 = 0; index88 < size87; index88++) {
const result89 = [];
const size90 = byteBuffer.readInt();
const size90 = buffer.readInt();
if (size90 > 0) {
for (let index91 = 0; index91 < size90; index91++) {
const list92 = byteBuffer.readIntArray();
const list92 = buffer.readIntArray();
result89.push(list92);
}
}
@@ -398,22 +398,22 @@ ComplexObject.read = function(byteBuffer) {
}
packet.mmmm = result79;
const result93 = new Map();
const size94 = byteBuffer.readInt();
const size94 = buffer.readInt();
if (size94 > 0) {
for (let index95 = 0; index95 < size94; index95++) {
const result96 = [];
const size97 = byteBuffer.readInt();
const size97 = buffer.readInt();
if (size97 > 0) {
for (let index98 = 0; index98 < size97; index98++) {
const map99 = byteBuffer.readIntStringMap();
const map99 = buffer.readIntStringMap();
result96.push(map99);
}
}
const result100 = new Set();
const size101 = byteBuffer.readInt();
const size101 = buffer.readInt();
if (size101 > 0) {
for (let index102 = 0; index102 < size101; index102++) {
const map103 = byteBuffer.readIntStringMap();
const map103 = buffer.readIntStringMap();
result100.add(map103);
}
}
@@ -421,17 +421,17 @@ ComplexObject.read = function(byteBuffer) {
}
}
packet.mmmmm = result93;
const set104 = byteBuffer.readIntArray();
const set104 = buffer.readIntArray();
packet.s = set104;
const result105 = new Set();
const size106 = byteBuffer.readInt();
const size106 = buffer.readInt();
if (size106 > 0) {
for (let index107 = 0; index107 < size106; index107++) {
const result108 = new Set();
const size109 = byteBuffer.readInt();
const size109 = buffer.readInt();
if (size109 > 0) {
for (let index110 = 0; index110 < size109; index110++) {
const list111 = byteBuffer.readIntArray();
const list111 = buffer.readIntArray();
result108.add(list111);
}
}
@@ -440,21 +440,21 @@ ComplexObject.read = function(byteBuffer) {
}
packet.ss = result105;
const result112 = new Set();
const size113 = byteBuffer.readInt();
const size113 = buffer.readInt();
if (size113 > 0) {
for (let index114 = 0; index114 < size113; index114++) {
const set115 = byteBuffer.readPacketArray(102);
const set115 = buffer.readPacketArray(102);
result112.add(set115);
}
}
packet.sss = result112;
const set116 = byteBuffer.readStringArray();
const set116 = buffer.readStringArray();
packet.ssss = set116;
const result117 = new Set();
const size118 = byteBuffer.readInt();
const size118 = buffer.readInt();
if (size118 > 0) {
for (let index119 = 0; index119 < size118; index119++) {
const map120 = byteBuffer.readIntStringMap();
const map120 = buffer.readIntStringMap();
result117.add(map120);
}
}
@@ -25,70 +25,70 @@ NormalObject.prototype.protocolId = function() {
return 101;
};
NormalObject.write = function(byteBuffer, packet) {
if (byteBuffer.writePacketFlag(packet)) {
NormalObject.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
byteBuffer.writeByte(packet.a);
byteBuffer.writeByteArray(packet.aaa);
byteBuffer.writeShort(packet.b);
byteBuffer.writeInt(packet.c);
byteBuffer.writeLong(packet.d);
byteBuffer.writeFloat(packet.e);
byteBuffer.writeDouble(packet.f);
byteBuffer.writeBoolean(packet.g);
byteBuffer.writeString(packet.jj);
byteBuffer.writePacket(packet.kk, 102);
byteBuffer.writeIntArray(packet.l);
byteBuffer.writeLongArray(packet.ll);
byteBuffer.writePacketArray(packet.lll, 102);
byteBuffer.writeStringArray(packet.llll);
byteBuffer.writeIntStringMap(packet.m);
byteBuffer.writeIntPacketMap(packet.mm, 102);
byteBuffer.writeIntArray(packet.s);
byteBuffer.writeStringArray(packet.ssss);
buffer.writeByte(packet.a);
buffer.writeByteArray(packet.aaa);
buffer.writeShort(packet.b);
buffer.writeInt(packet.c);
buffer.writeLong(packet.d);
buffer.writeFloat(packet.e);
buffer.writeDouble(packet.f);
buffer.writeBoolean(packet.g);
buffer.writeString(packet.jj);
buffer.writePacket(packet.kk, 102);
buffer.writeIntArray(packet.l);
buffer.writeLongArray(packet.ll);
buffer.writePacketArray(packet.lll, 102);
buffer.writeStringArray(packet.llll);
buffer.writeIntStringMap(packet.m);
buffer.writeIntPacketMap(packet.mm, 102);
buffer.writeIntArray(packet.s);
buffer.writeStringArray(packet.ssss);
};
NormalObject.read = function(byteBuffer) {
if (!byteBuffer.readBoolean()) {
NormalObject.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new NormalObject();
const result0 = byteBuffer.readByte();
const result0 = buffer.readByte();
packet.a = result0;
const array1 = byteBuffer.readByteArray();
const array1 = buffer.readByteArray();
packet.aaa = array1;
const result2 = byteBuffer.readShort();
const result2 = buffer.readShort();
packet.b = result2;
const result3 = byteBuffer.readInt();
const result3 = buffer.readInt();
packet.c = result3;
const result4 = byteBuffer.readLong();
const result4 = buffer.readLong();
packet.d = result4;
const result5 = byteBuffer.readFloat();
const result5 = buffer.readFloat();
packet.e = result5;
const result6 = byteBuffer.readDouble();
const result6 = buffer.readDouble();
packet.f = result6;
const result7 = byteBuffer.readBoolean();
const result7 = buffer.readBoolean();
packet.g = result7;
const result8 = byteBuffer.readString();
const result8 = buffer.readString();
packet.jj = result8;
const result9 = byteBuffer.readPacket(102);
const result9 = buffer.readPacket(102);
packet.kk = result9;
const list10 = byteBuffer.readIntArray();
const list10 = buffer.readIntArray();
packet.l = list10;
const list11 = byteBuffer.readLongArray();
const list11 = buffer.readLongArray();
packet.ll = list11;
const list12 = byteBuffer.readPacketArray(102);
const list12 = buffer.readPacketArray(102);
packet.lll = list12;
const list13 = byteBuffer.readStringArray();
const list13 = buffer.readStringArray();
packet.llll = list13;
const map14 = byteBuffer.readIntStringMap();
const map14 = buffer.readIntStringMap();
packet.m = map14;
const map15 = byteBuffer.readIntPacketMap(102);
const map15 = buffer.readIntPacketMap(102);
packet.mm = map15;
const set16 = byteBuffer.readIntArray();
const set16 = buffer.readIntArray();
packet.s = set16;
const set17 = byteBuffer.readStringArray();
const set17 = buffer.readStringArray();
packet.ssss = set17;
return packet;
};
@@ -10,25 +10,25 @@ ObjectA.prototype.protocolId = function() {
return 102;
};
ObjectA.write = function(byteBuffer, packet) {
if (byteBuffer.writePacketFlag(packet)) {
ObjectA.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
byteBuffer.writeInt(packet.a);
byteBuffer.writeIntStringMap(packet.m);
byteBuffer.writePacket(packet.objectB, 103);
buffer.writeInt(packet.a);
buffer.writeIntStringMap(packet.m);
buffer.writePacket(packet.objectB, 103);
};
ObjectA.read = function(byteBuffer) {
if (!byteBuffer.readBoolean()) {
ObjectA.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new ObjectA();
const result0 = byteBuffer.readInt();
const result0 = buffer.readInt();
packet.a = result0;
const map1 = byteBuffer.readIntStringMap();
const map1 = buffer.readIntStringMap();
packet.m = map1;
const result2 = byteBuffer.readPacket(103);
const result2 = buffer.readPacket(103);
packet.objectB = result2;
return packet;
};
@@ -8,19 +8,19 @@ ObjectB.prototype.protocolId = function() {
return 103;
};
ObjectB.write = function(byteBuffer, packet) {
if (byteBuffer.writePacketFlag(packet)) {
ObjectB.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
byteBuffer.writeBoolean(packet.flag);
buffer.writeBoolean(packet.flag);
};
ObjectB.read = function(byteBuffer) {
if (!byteBuffer.readBoolean()) {
ObjectB.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new ObjectB();
const result0 = byteBuffer.readBoolean();
const result0 = buffer.readBoolean();
packet.flag = result0;
return packet;
};
@@ -9,22 +9,22 @@ SimpleObject.prototype.protocolId = function() {
return 104;
};
SimpleObject.write = function(byteBuffer, packet) {
if (byteBuffer.writePacketFlag(packet)) {
SimpleObject.write = function(buffer, packet) {
if (buffer.writePacketFlag(packet)) {
return;
}
byteBuffer.writeInt(packet.c);
byteBuffer.writeBoolean(packet.g);
buffer.writeInt(packet.c);
buffer.writeBoolean(packet.g);
};
SimpleObject.read = function(byteBuffer) {
if (!byteBuffer.readBoolean()) {
SimpleObject.read = function(buffer) {
if (!buffer.readBoolean()) {
return null;
}
const packet = new SimpleObject();
const result0 = byteBuffer.readInt();
const result0 = buffer.readInt();
packet.c = result0;
const result1 = byteBuffer.readBoolean();
const result1 = buffer.readBoolean();
packet.g = result1;
return packet;
};