public TextFrame setPayload(String str) { setPayload(ByteBuffer.wrap(StringUtil.getUtf8Bytes(str))); return this; }
public BinaryFrame setPayload(String payload) { setPayload(StringUtil.getUtf8Bytes(payload)); return this; }
public PongFrame setPayload(String payload) { setPayload(StringUtil.getUtf8Bytes(payload)); return this; }
public void parse(String raw) { byte[] b = StringUtil.getUtf8Bytes(raw); parse2(b,0,b.length); _rawString=raw; }
public PingFrame setPayload(String payload) { setPayload(ByteBuffer.wrap(StringUtil.getUtf8Bytes(payload))); return this; }
public void parse(String raw) { byte[] b = StringUtil.getUtf8Bytes(raw); parse2(b,0,b.length); _rawString=raw; }
public ContinuationFrame setPayload(String message) { return this.setPayload(StringUtil.getUtf8Bytes(message)); }
public void parse(String raw) { byte[] b = StringUtil.getUtf8Bytes(raw); parse2(b,0,b.length); _rawString=raw; }
private byte[] asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } int len = 2; // status code byte utf[] = null; if (StringUtil.isNotBlank(reason)) { utf = StringUtil.getUtf8Bytes(reason); len += utf.length; } byte buf[] = new byte[len]; buf[0] = (byte)((statusCode >>> 8) & 0xFF); buf[1] = (byte)((statusCode >>> 0) & 0xFF); if (utf != null) { System.arraycopy(utf,0,buf,2,utf.length); } return buf; }
private byte[] asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } int len = 2; // status code byte utf[] = null; if (StringUtil.isNotBlank(reason)) { utf = StringUtil.getUtf8Bytes(reason); len += utf.length; } byte buf[] = new byte[len]; buf[0] = (byte)((statusCode >>> 8) & 0xFF); buf[1] = (byte)((statusCode >>> 0) & 0xFF); if (utf != null) { System.arraycopy(utf,0,buf,2,utf.length); } return buf; }
public ByteBuffer asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } ByteBuffer buf = ByteBuffer.allocate(WebSocketFrame.MAX_CONTROL_PAYLOAD); buf.putChar((char)statusCode); if (StringUtil.isNotBlank(reason)) { byte utf[] = StringUtil.getUtf8Bytes(reason); buf.put(utf,0,utf.length); } BufferUtil.flipToFlush(buf,0); return buf; }