Skip to content

Commit 35ee10c

Browse files
committed
reduce bytes copy
1 parent d1090d2 commit 35ee10c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingSerializable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static byte[] encode(final Object obj) {
3030
if (obj == null) {
3131
return null;
3232
}
33-
return JSON.toJSONBytes(obj);
33+
return JSON.toJSONBytes(obj, CHARSET_UTF8);
3434
}
3535

3636
public static String toJson(final Object obj, boolean prettyFormat) {
@@ -59,7 +59,7 @@ public static <T> T fromJson(String json, Class<T> classOfT) {
5959
}
6060

6161
public byte[] encode() {
62-
return JSON.toJSONBytes(this);
62+
return JSON.toJSONBytes(this, CHARSET_UTF8);
6363
}
6464

6565
/**
@@ -69,7 +69,7 @@ public byte[] encode() {
6969
* @return serialized data.
7070
*/
7171
public byte[] encode(JSONWriter.Feature... features) {
72-
return JSON.toJSONBytes(this, features);
72+
return JSON.toJSONBytes(this, CHARSET_UTF8, features);
7373
}
7474

7575
public String toJson() {

0 commit comments

Comments
 (0)