Polishing

This commit is contained in:
Juergen Hoeller
2014-11-11 03:21:43 +01:00
parent b331d65019
commit e42e2330b3
3 changed files with 19 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ import java.nio.charset.Charset;
*/
public final class TextMessage extends AbstractWebSocketMessage<String> {
private static final Charset UTF_8 = Charset.forName("UTF-8");
private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
private final byte[] bytes;
@@ -46,7 +46,7 @@ public final class TextMessage extends AbstractWebSocketMessage<String> {
* @param payload the non-null payload
*/
public TextMessage(byte[] payload) {
super(new String(payload, UTF_8));
super(new String(payload, UTF8_CHARSET));
this.bytes = payload;
}
@@ -70,7 +70,7 @@ public final class TextMessage extends AbstractWebSocketMessage<String> {
}
public byte[] asBytes() {
return (this.bytes != null ? this.bytes : getPayload().getBytes(UTF_8));
return (this.bytes != null ? this.bytes : getPayload().getBytes(UTF8_CHARSET));
}
@Override