Package org.jboss.netty.buffer

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


                        }
                    }
                    if (result.bytesProduced() > 0) {
                        outNetBuf.flip();
                        msg = ChannelBuffers.buffer(outNetBuf.remaining());
                        msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                        outNetBuf.clear();

                        if (pendingWrite.outAppBuf.hasRemaining()) {
                            // pendingWrite's future shouldn't be notified if
                            // only partial data is written.
View Full Code Here


                }

                if (result.bytesProduced() > 0) {
                    outNetBuf.flip();
                    ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
                    msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                    outNetBuf.clear();
                    if (channel.isConnected()) {
                        future = future(channel);
                        write(ctx, channel, future, msg);
                    }
View Full Code Here

            outAppBuf.flip();

            if (outAppBuf.hasRemaining()) {
                ChannelBuffer frame = ChannelBuffers.buffer(outAppBuf.remaining());
                frame.writeBytes(outAppBuf.array(), 0, frame.capacity());
                return frame;
            } else {
                return null;
            }
        } catch (SSLException e) {
View Full Code Here

    } else  if(msgO instanceof HttpChunk){
      HttpChunk msgReq = (HttpChunk)msgO;
      resp = msgReq.toString();
    } else {
      ChannelBuffer msg = (ChannelBuffer)msgO;
      byte[] bytes = new byte[msg.capacity()];
      msg.readBytes(bytes);
      msg.setIndex(0, bytes.length);
      StringBuilder out = new StringBuilder("MSG: ").append(e.getChannel().getRemoteAddress());
      out.append("\nMESSAGE length=").append(bytes.length).append("\n").append(new String(bytes));
      resp = out.toString();
View Full Code Here

                        }
                    }
                    if (result.bytesProduced() > 0) {
                        outNetBuf.flip();
                        msg = ChannelBuffers.buffer(outNetBuf.remaining());
                        msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                        outNetBuf.clear();

                        if (pendingWrite.outAppBuf.hasRemaining()) {
                            // pendingWrite's future shouldn't be notified if
                            // only partial data is written.
View Full Code Here

                result = engine.wrap(EMPTY_BUFFER, outNetBuf);

                if (result.bytesProduced() > 0) {
                    outNetBuf.flip();
                    ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
                    msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                    outNetBuf.clear();
                    if (channel.isConnected()) {
                        future = future(channel);
                        write(ctx, channel, future, msg);
                    }
View Full Code Here

            outAppBuf.flip();

            if (outAppBuf.hasRemaining()) {
                ChannelBuffer frame = ChannelBuffers.buffer(outAppBuf.remaining());
                frame.writeBytes(outAppBuf.array(), 0, frame.capacity());
                return frame;
            } else {
                return null;
            }
        } catch (SSLException e) {
View Full Code Here

    /**
     * Slim down internal buffer if it exceeds the limit established on creation
     */
    protected void slimDownBuffer() {
       ChannelBuffer buf = cumulation.get();
       if (buf != null && buf.capacity() > maxCapacity) {
          if (cumulation.compareAndSet(buf, null))
             replayable = null;
       }
    }

View Full Code Here

                        response = handleGet(storeList);
                    } else if(httpMethod.equals(HttpMethod.POST)) {
                        Map<String, Properties> configsToPut = Maps.newHashMap();
                        ChannelBuffer content = this.request.getContent();
                        if(content != null) {
                            byte[] postBody = new byte[content.capacity()];
                            content.readBytes(postBody);
                            configsToPut = ClientConfigUtil.readMultipleClientConfigAvro(new String(postBody));
                        }
                        response = handlePut(configsToPut);
                    } else if(httpMethod.equals(HttpMethod.DELETE)) {
View Full Code Here

           
            if (buf.hasArray()) {
                line = buf.array();
            } else {
                // copy the ChannelBuffer to a byte array to process the LineHandler
                line = new byte[buf.capacity()];
                buf.getBytes(0, line);
            }
           
            LineHandler lHandler=  (LineHandler) lineHandlers.getLast();
            long start = System.currentTimeMillis();           
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.