Package io.netty.buffer

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


        DiskFileUpload upload = new DiskFileUpload(getName(),
                getFilename(), getContentType(), getContentTransferEncoding(), getCharset(), size);
        ByteBuf buf = content();
        if (buf != null) {
            try {
                upload.setContent(buf.duplicate());
            } catch (IOException e) {
                throw new ChannelException(e);
            }
        }
        return upload;
View Full Code Here


        DiskAttribute attr = new DiskAttribute(getName());
        attr.setCharset(getCharset());
        ByteBuf content = content();
        if (content != null) {
            try {
                attr.setContent(content.duplicate());
            } catch (IOException e) {
                throw new ChannelException(e);
            }
        }
        return attr;
View Full Code Here

        MemoryFileUpload upload = new MemoryFileUpload(getName(), getFilename(), getContentType(),
                getContentTransferEncoding(), getCharset(), size);
        ByteBuf buf = content();
        if (buf != null) {
            try {
                upload.setContent(buf.duplicate());
                return upload;
            } catch (IOException e) {
                throw new ChannelException(e);
            }
        }
View Full Code Here

        MemoryAttribute attr = new MemoryAttribute(getName());
        attr.setCharset(getCharset());
        ByteBuf content = content();
        if (content != null) {
            try {
                attr.setContent(content.duplicate());
            } catch (IOException e) {
                throw new ChannelException(e);
            }
        }
        return attr;
View Full Code Here

        final ByteBuf buf = Unpooled.copiedBuffer("your data",
                CharsetUtil.UTF_8);
        Runnable writer = new Runnable() {
            @Override
            public void run() {
                channel.write(buf.duplicate());
            }
        };
        Executor executor = Executors.newCachedThreadPool();

        // write in one thread
View Full Code Here

                 public void initChannel(SocketChannel ch)
                     throws Exception {
                     ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                         @Override
                         public void channelActive(ChannelHandlerContext ctx) throws Exception {
                             ctx.write(buf.duplicate()).addListener(ChannelFutureListener.CLOSE);
                         }
                     });
                 }
             });
            ChannelFuture f = b.bind().sync();
View Full Code Here

                 public void initChannel(SocketChannel ch)
                     throws Exception {
                     ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                         @Override
                         public void channelActive(ChannelHandlerContext ctx) throws Exception {
                             ctx.write(buf.duplicate()).addListener(ChannelFutureListener.CLOSE);
                         }
                     });
                 }
             });
            ChannelFuture f = b.bind().sync();
View Full Code Here

        for (int i = 0; i < 256; i ++) {
            headerBlock.writeInt(RANDOM.nextInt());
        }

        delegate.readHeadersFrame(streamId, false);
        delegate.readHeaderBlock(headerBlock.duplicate());
        delegate.readHeaderBlockEnd();
        replay(delegate);
        decoder.decode(buf);
        decoder.decode(headerBlock);
        verify(delegate);
View Full Code Here

        for (int i = 0; i < 256; i ++) {
            headerBlock.writeInt(RANDOM.nextInt());
        }

        delegate.readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
        delegate.readHeaderBlock(headerBlock.duplicate());
        delegate.readHeaderBlockEnd();
        replay(delegate);
        decoder.decode(buf);
        decoder.decode(headerBlock);
        verify(delegate);
View Full Code Here

        for (int i = 0; i < 256; i ++) {
            headerBlock.writeInt(RANDOM.nextInt());
        }

        delegate.readSynReplyFrame(streamId, false);
        delegate.readHeaderBlock(headerBlock.duplicate());
        delegate.readHeaderBlockEnd();
        replay(delegate);
        decoder.decode(buf);
        decoder.decode(headerBlock);
        verify(delegate);
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.