moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.3k stars 818 forks source link

Fix #659: use buffer.toString(Charset) to directly get a String #660

Closed hylkevds closed 2 years ago

hylkevds commented 2 years ago

When the goal is to turn the contents of a buffer into a String it is more efficient and simpler to directly use the toString(Charset) method of ByteBuf instead of fetching the byte data and manually creating a string.

This PR replaces the two spots where buffers are turned into Strings using the "old" way.

andsel commented 2 years ago

Thanks @hylkevds to have spotted and fixed it!