Package org.jboss.netty.buffer

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


            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes()).build();
            } else {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes(), extensionRegistry).build();
            }
        } else {
            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        new ChannelBufferInputStream((ChannelBuffer) msg)).build();
View Full Code Here


          log.debug("Connect Command SUCCESS :  {}" , replyCode);

          connectCommandResult = true;
         
        }else{
          HandleProxyCommandError(msg.array(),
              proxySettings.getFeedServer().getPrimary(), 7500);
         
          connectCommandResult = false;
        }
       
View Full Code Here

       * pipeline); it fits single ddf message only w/o delimiters;
       */
      final ChannelBuffer frameBuffer = (ChannelBuffer) messageRAW;

      /* underlying frame array */
      byte[] array = frameBuffer.array();

      /*
       * silent ignore of invalid chunks sometimes sent by JERQ; DDF must
       * have at least 1 command char and 1 terminator
       */
 
View Full Code Here

        ChannelBuffer buf = (ChannelBuffer) msg;
        if (buf.hasArray()) {
            final int offset = buf.readerIndex();
            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes()).build();
            } else {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes(), extensionRegistry).build();
            }
        } else {
View Full Code Here

            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes()).build();
            } else {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes(), extensionRegistry).build();
            }
        } else {
            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        new ChannelBufferInputStream((ChannelBuffer) msg)).build();
View Full Code Here

       * pipeline); it fits single ddf message only w/o delimiters;
       */
      final ChannelBuffer frameBuffer = (ChannelBuffer) messageRAW;

      /* underlying frame array */
      byte[] array = frameBuffer.array();

      /*
       * silent ignore of invalid chunks sometimes sent by JERQ; DDF must
       * have at least 1 command char and 1 terminator
       */
 
View Full Code Here

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        ChannelBuffer buf = (ChannelBuffer) e.getMessage();
        byte data[];
        if (buf.hasArray()) {
            data = buf.array();
        } else {
            data = new byte[buf.readableBytes()];
            buf.readBytes(data);
        }
        lineHandler.onLine(session, data);
View Full Code Here

        if (channelBuffer.writable()) {
            throw new IllegalStateException("write bytes not be filled full! type = " + channelBuffer.getShort(2));
        }
        ProtocolCoder coder = GameBoss.getInstance().getProtocolCoder();
        if (coder != null) {
            coder.encode(channelBuffer.array(), GameBoss.getInstance().getWriteHeaderSize());
        }
        channel.write(gameBuffer.getChannelBuffer());
    }

    public void kill(GameDownBuffer buffer) throws IllegalStateException {
View Full Code Here

        if (channel.isConnected()) {
            if (buffer != null) {
                ChannelBuffer channelBuffer = buffer.getChannelBuffer();
                ProtocolCoder coder = GameBoss.getInstance().getProtocolCoder();
                if (coder != null) {
                    coder.encode(channelBuffer.array(), GameBoss.getInstance().getWriteHeaderSize());
                }

                if (channelBuffer.writable()) {
                    throw new IllegalStateException("write bytes not be filled full! type = " + channelBuffer.getShort(2));
                }
View Full Code Here

    @Override
    protected Object decode(ChannelHandlerContext ctx, Channel ch, ChannelBuffer cb) throws Exception {
        ChannelBuffer buffer = (ChannelBuffer) super.decode(ctx, ch, cb);
        ProtocolCoder coder = GameBoss.getInstance().getProtocolCoder();
        if (coder != null && buffer != null) {
            byte[] decodebytes = coder.decode(buffer.array());
            return ChannelBuffers.wrappedBuffer(decodebytes);
        }
        return buffer;
    }
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.