Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.readBytes()


        @Override
        public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
            synchronized (this) {
                buffer.readBytes(out, buffer.readableBytes());
                out.flush();
            }
        }

        @Override
View Full Code Here


        synchronized (z) {
            try {
                // Configure input.
                ChannelBuffer uncompressed = (ChannelBuffer) msg;
                byte[] in = new byte[uncompressed.readableBytes()];
                uncompressed.readBytes(in);
                z.next_in = in;
                z.next_in_index = 0;
                z.avail_in = in.length;

                // Configure output.
View Full Code Here

        synchronized (z) {
            try {
                // Configure input.
                ChannelBuffer compressed = (ChannelBuffer) msg;
                byte[] in = new byte[compressed.readableBytes()];
                compressed.readBytes(in);
                z.next_in = in;
                z.next_in_index = 0;
                z.avail_in = in.length;

                // Configure output.
View Full Code Here

              isEarlyTerminated = content.readableBytes() < message.getPreviewAmount();
            }
          while(content.readableBytes() > 0) {
            IcapChunk chunk = null;
            if(content.readableBytes() > chunkSize) {
              chunk = new DefaultIcapChunk(content.readBytes(chunkSize));
            } else {
              chunk = new DefaultIcapChunk(content.readBytes(content.readableBytes()));
            }
            chunk.setPreviewChunk(isPreview);
            chunk.setEarlyTermination(isEarlyTerminated);
View Full Code Here

          while(content.readableBytes() > 0) {
            IcapChunk chunk = null;
            if(content.readableBytes() > chunkSize) {
              chunk = new DefaultIcapChunk(content.readBytes(chunkSize));
            } else {
              chunk = new DefaultIcapChunk(content.readBytes(content.readableBytes()));
            }
            chunk.setPreviewChunk(isPreview);
            chunk.setEarlyTermination(isEarlyTerminated);
            fireDownstreamEvent(ctx,chunk,msgEvent);
            if(chunk.isLast() | content.readableBytes() <= 0) {
View Full Code Here

    }

    if (HttpHeaders.getContentLength(nettyRequest) > 0) {
      byte data[] = new byte[(int) HttpHeaders.getContentLength(nettyRequest)];
      ChannelBuffer content = nettyRequest.getContent();
      content.readBytes(data);
      request.setTextContent(new String(data, "UTF-8"));
    }

    if (request != null) {
      logger.trace("HTTP: " + request.getArgument() + " / "
View Full Code Here

        this.embededServer = embededServer;
    }

    public void messageReceived(final ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
        final Packet packet = Packet.parseFrom(buffer.readBytes(buffer.readableBytes()).array());
        switch (packet.getVersion()) {
            case SUPPORTED_VERSION:
            default:
                final ClientAuth clientAuth = ClientAuth.parseFrom(packet.getBody());
                // 如果存在订阅信息
View Full Code Here

    }

    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        logger.info("message receives in session handler...");
        ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
        Packet packet = Packet.parseFrom(buffer.readBytes(buffer.readableBytes()).array());
        ClientIdentity clientIdentity = null;
        try {
            switch (packet.getType()) {
                case SUBSCRIPTION:
                    Sub sub = Sub.parseFrom(packet.getBody());
View Full Code Here

        this.processRequestHeaders(request);

        ChannelBuffer inputBuffer = request.getContent();
        byte[] requestData = new byte[inputBuffer.readableBytes()];
        inputBuffer.readBytes(requestData, 0, requestData.length);

        // Prepare request Wrapper
        HttpRequestWrapper executorHttpRequest = new HttpRequestWrapper();
        executorHttpRequest.setData(requestData);
        executorHttpRequest.setMethod(request.getMethod().toString());
View Full Code Here

            UnsafeByteArrayInputStream bis;
            try {
                do {
                    // read data into buffer.
                    int read = Math.min(readable, buf.length - limit);
                    input.readBytes(buf, limit, read);
                    limit += read;
                    readable -= read;
                    bis = new UnsafeByteArrayInputStream(buf, off, limit - off); // 不需要关闭
                    // decode object.
                    do {
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.