private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { try { if (utf8Validator == null) { utf8Validator = new Utf8Validator(); } utf8Validator.check(bytes); } catch (CorruptedFrameException ex) { protocolViolation(channel, ex); } }
/** * Creates a new continuation frame with the specified binary data. The final fragment flag is * set to true. * * @param binaryData * the content of the frame. */ public ContinuationWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); }
/** * Creates a new empty close frame. */ public CloseWebSocketFrame() { setBinaryData(ChannelBuffers.EMPTY_BUFFER); }
/** * Creates a new binary frame with the specified binary data and the final fragment flag. * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param binaryData * the content of the frame. */ public BinaryWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); }
/** * Creates a new text frame with the specified binary data. The final fragment flag is set to true. * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param binaryData * the content of the frame. Must be UTF-8 encoded */ public TextWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); }
/** * Creates a new continuation frame with the specified text data * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param text * text content of the frame. */ public ContinuationWebSocketFrame(boolean finalFragment, int rsv, String text) { setFinalFragment(finalFragment); setRsv(rsv); setText(text); }
/** * Creates a new continuation frame with the specified binary data * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param binaryData * the content of the frame. */ public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); }
/** * Creates a new pong frame with the specified binary data * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param binaryData * the content of the frame. */ public PongWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); }
/** * Creates a new ping frame with the specified binary data * * @param finalFragment * flag indicating if this frame is the final fragment * @param rsv * reserved bits used for protocol extensions * @param binaryData * the content of the frame. */ public PingWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); }
/** * Creates a new empty ping frame. */ public PingWebSocketFrame() { setFinalFragment(true); setBinaryData(ChannelBuffers.EMPTY_BUFFER); }
/** * Creates a new empty pong frame. */ public PongWebSocketFrame() { setBinaryData(ChannelBuffers.EMPTY_BUFFER); }
/** * Creates a new text frame with the specified binary data. The final fragment flag is set to true. * * @param binaryData * the content of the frame. Must be UTF-8 encoded */ public TextWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); }
/** * Creates a new binary frame with the specified binary data. The final fragment flag is set to true. * * @param binaryData * the content of the frame. */ public BinaryWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); }
/** * Creates a new ping frame with the specified binary data. * * @param binaryData * the content of the frame. */ public PingWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); }
public void check(byte[] bytes) throws CorruptedFrameException { checking = true; for (byte b : bytes) { write(b); } }
/** * Creates some random bytes * * @param size * Number of random bytes to create * @return random bytes */ static byte[] randomBytes(int size) { byte[] bytes = new byte[size]; for (int i = 0; i < size; i++) { bytes[i] = (byte) randomNumber(0, 255); } return bytes; }
/** * Creates a new empty continuation frame. */ public ContinuationWebSocketFrame() { setBinaryData(ChannelBuffers.EMPTY_BUFFER); }
/** * Creates a new pong frame with the specified binary data. * * @param binaryData * the content of the frame. */ public PongWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); }
/** * Creates a new empty text frame. */ public TextWebSocketFrame() { setBinaryData(ChannelBuffers.EMPTY_BUFFER); }
/** * Creates a new empty binary frame. */ public BinaryWebSocketFrame() { setBinaryData(ChannelBuffers.EMPTY_BUFFER); }