Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.release()


        final DefaultFullHttpRequest r = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/test");
        r.headers().set(HttpHeaders.Names.CONTENT_TYPE, Transports.CONTENT_TYPE_FORM);
        if (data == null) {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=", CharsetUtil.UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        } else {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=" + data, CharsetUtil.UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        }
View Full Code Here


            r.content().writeBytes(byteBuf);
            byteBuf.release();
        } else {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=" + data, CharsetUtil.UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        }
        return r;
    }

}
View Full Code Here

    private static FullHttpRequest requestWithBody(final String body, HttpVersion httpVersion) {
        final DefaultFullHttpRequest r = new DefaultFullHttpRequest(httpVersion, HttpMethod.GET, "/test");
        if (body != null) {
            final ByteBuf byteBuf = Unpooled.copiedBuffer(body, UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        }
        return r;
    }

    private static FullHttpRequest requestWithFormData(final String data) {
View Full Code Here

        final DefaultFullHttpRequest r = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/test");
        r.headers().set(HttpHeaders.Names.CONTENT_TYPE, Transports.CONTENT_TYPE_FORM);
        if (data == null) {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=", UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        } else {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=" + data, UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        }
View Full Code Here

            r.content().writeBytes(byteBuf);
            byteBuf.release();
        } else {
            final ByteBuf byteBuf = Unpooled.copiedBuffer("d=" + data, UTF_8);
            r.content().writeBytes(byteBuf);
            byteBuf.release();
        }
        return r;
    }

}
View Full Code Here

                    byteBuf = allocHandle.allocate(allocator);
                    int writable = byteBuf.writableBytes();
                    int localReadAmount = doReadBytes(byteBuf);
                    if (localReadAmount <= 0) {
                        // not was read release the buffer
                        byteBuf.release();
                        close = localReadAmount < 0;
                        break;
                    }
                    readPending = false;
                    pipeline.fireChannelRead(byteBuf);
View Full Code Here

                        // - https://github.com/netty/netty/issues/2327
                        // - https://github.com/netty/netty/issues/1764
                        expandCumulation(ctx, data.readableBytes());
                    }
                    cumulation.writeBytes(data);
                    data.release();
                }
                callDecode(ctx, cumulation, out);
            } catch (DecoderException e) {
                throw e;
            } catch (Throwable t) {
View Full Code Here

    private void expandCumulation(ChannelHandlerContext ctx, int readable) {
        ByteBuf oldCumulation = cumulation;
        cumulation = ctx.alloc().buffer(oldCumulation.readableBytes() + readable);
        cumulation.writeBytes(oldCumulation);
        oldCumulation.release();
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        if (cumulation != null && !first && cumulation.refCnt() == 1) {
View Full Code Here

                        spdySynStreamFrame.isLast(),
                        spdySynStreamFrame.isUnidirectional(),
                        headerBlock
                );
            } finally {
                headerBlock.release();
            }
            ctx.write(frame, promise);

        } else if (msg instanceof SpdySynReplyFrame) {
View Full Code Here

                        spdySynReplyFrame.streamId(),
                        spdySynReplyFrame.isLast(),
                        headerBlock
                );
            } finally {
                headerBlock.release();
            }
            ctx.write(frame, promise);

        } else if (msg instanceof SpdyRstStreamFrame) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.