Simplify conversion of DataBuffer to String

See gh-24786
This commit is contained in:
Сергей Цыпанов
2020-03-26 11:39:56 +02:00
committed by Rossen Stoyanchev
parent ac11acb532
commit f17b0125ff
10 changed files with 24 additions and 38 deletions

View File

@@ -84,9 +84,7 @@ public class WebSocketMessage {
* @since 5.0.5
*/
public String getPayloadAsText(Charset charset) {
byte[] bytes = new byte[this.payload.readableByteCount()];
this.payload.read(bytes);
return new String(bytes, charset);
return this.payload.toString(charset);
}
/**