@Override protected boolean appendFrameTail(WebSocketFrame msg) { return msg.isFinalFragment(); }
@Override protected boolean removeFrameTail(WebSocketFrame msg) { return msg.isFinalFragment(); }
@Override protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.decode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } } }
@Override protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.encode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } }
WebSocketFrameInternal decodeFrame(WebSocketFrame msg) { ByteBuf payload = safeBuffer(msg, chctx.alloc()); boolean isFinal = msg.isFinalFragment(); FrameType frameType; if (msg instanceof BinaryWebSocketFrame) { frameType = FrameType.BINARY; } else if (msg instanceof CloseWebSocketFrame) { frameType = FrameType.CLOSE; } else if (msg instanceof PingWebSocketFrame) { frameType = FrameType.PING; } else if (msg instanceof PongWebSocketFrame) { frameType = FrameType.PONG; } else if (msg instanceof TextWebSocketFrame) { frameType = FrameType.TEXT; } else if (msg instanceof ContinuationWebSocketFrame) { frameType = FrameType.CONTINUATION; } else { throw new IllegalStateException("Unsupported websocket msg " + msg); } return new WebSocketFrameImpl(frameType, payload, isFinal); }
private void onTextFrame0(WebSocketFrame frame) { // faster than frame.text(); String text = Utf8ByteBufCharsetDecoder.decodeUtf8(frame.content()); frame.isFinalFragment(); frame.rsv(); for (WebSocketListener listener : listeners) { listener.onTextFrame(text, frame.isFinalFragment(), frame.rsv()); } }
@Override protected boolean isAggregated(WebSocketFrame msg) throws Exception { if (msg.isFinalFragment()) { return !isContentMessage(msg); } return !isStartMessage(msg) && !isContentMessage(msg); }
private void onBinaryFrame0(WebSocketFrame frame) { byte[] bytes = byteBuf2Bytes(frame.content()); for (WebSocketListener listener : listeners) { listener.onBinaryFrame(bytes, frame.isFinalFragment(), frame.rsv()); } }
if (msg.isFinalFragment()) { b0 |= 1 << 7;
if (msg.isFinalFragment() && noContext) { cleanup(); outMsg = new TextWebSocketFrame(msg.isFinalFragment(), newRsv(msg), compositeUncompressedContent); } else if (msg instanceof BinaryWebSocketFrame) { outMsg = new BinaryWebSocketFrame(msg.isFinalFragment(), newRsv(msg), compositeUncompressedContent); } else if (msg instanceof ContinuationWebSocketFrame) { outMsg = new ContinuationWebSocketFrame(msg.isFinalFragment(), newRsv(msg), compositeUncompressedContent); } else {
if (msg.isFinalFragment() && noContext) { cleanup(); outMsg = new TextWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent); } else if (msg instanceof BinaryWebSocketFrame) { outMsg = new BinaryWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent); } else if (msg instanceof ContinuationWebSocketFrame) { outMsg = new ContinuationWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent); } else { throw new CodecException("unexpected frame type: " + msg.getClass().getName());
if (((WebSocketFrame) msg).isFinalFragment()) {
WebSocketFrameInternal decodeFrame(WebSocketFrame msg) { ByteBuf payload = safeBuffer(msg, chctx.alloc()); boolean isFinal = msg.isFinalFragment(); FrameType frameType; if (msg instanceof BinaryWebSocketFrame) { frameType = FrameType.BINARY; } else if (msg instanceof CloseWebSocketFrame) { frameType = FrameType.CLOSE; } else if (msg instanceof PingWebSocketFrame) { frameType = FrameType.PING; } else if (msg instanceof PongWebSocketFrame) { frameType = FrameType.PONG; } else if (msg instanceof TextWebSocketFrame) { frameType = FrameType.TEXT; } else if (msg instanceof ContinuationWebSocketFrame) { frameType = FrameType.CONTINUATION; } else { throw new IllegalStateException("Unsupported websocket msg " + msg); } return new WebSocketFrameImpl(frameType, payload, isFinal); }
@Override protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.decode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } } }
@Override protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.decode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } } }
@Override protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.encode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } }
@Override protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.decode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } } }
@Override protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { super.encode(ctx, msg, out); if (msg.isFinalFragment()) { compressing = false; } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) { compressing = true; } }
@Override protected boolean isAggregated(WebSocketFrame msg) throws Exception { if (msg.isFinalFragment()) { return !isContentMessage(msg); } return !isStartMessage(msg) && !isContentMessage(msg); }
@Override protected boolean isAggregated(WebSocketFrame msg) throws Exception { if (msg.isFinalFragment()) { return !isContentMessage(msg); } return !isStartMessage(msg) && !isContentMessage(msg); }