Package org.jboss.netty.buffer

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


    protected ChannelBuffer getData() {
        ChannelBuffer channelBuffer = ChannelBuffers.buffer(1);
        if(action == Action.WakeUp)
            channelBuffer.writeByte(0);
        else
            channelBuffer.writeByte(1);

        return channelBuffer;
    }
}
View Full Code Here


    }

    @Override
    protected ChannelBuffer getData() {
        ChannelBuffer channelBuffer = ChannelBuffers.buffer(1);
        channelBuffer.writeByte(time);
        return channelBuffer;
    }
}
View Full Code Here

    protected abstract ChannelBuffer getData();

    public ChannelBuffer getFullData() {
        final ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer();
        channelBuffer.writeByte(0x7f);
        channelBuffer.writeByte(getType());
        final ChannelBuffer encryptedData = getData();
        int len = encryptedData.readableBytes();
        byte[] lenBytes = new byte[]{(byte) (len >>> 16), (byte) (len >>> 8), (byte) len};
        channelBuffer.writeBytes(lenBytes);
View Full Code Here

    protected abstract ChannelBuffer getData();

    public ChannelBuffer getFullData() {
        final ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer();
        channelBuffer.writeByte(0x7f);
        channelBuffer.writeByte(getType());
        final ChannelBuffer encryptedData = getData();
        int len = encryptedData.readableBytes();
        byte[] lenBytes = new byte[]{(byte) (len >>> 16), (byte) (len >>> 8), (byte) len};
        channelBuffer.writeBytes(lenBytes);
        channelBuffer.writeBytes(encryptedData);
View Full Code Here

    {
      return msg;
    }
    Event event = (Event) msg;
    ChannelBuffer opCode = ChannelBuffers.buffer(1);
    opCode.writeByte(event.getType());
    ChannelBuffer buffer = null;
    if (null != event.getSource())
    {
      @SuppressWarnings("unchecked")
      MessageBuffer<ChannelBuffer> msgBuffer = (MessageBuffer<ChannelBuffer>) event
View Full Code Here

  }
 
  public static ChannelBuffer createBufferForOpcode(int opcode)
  {
    ChannelBuffer buffer = ChannelBuffers.buffer(1);
    buffer.writeByte(opcode);
    return buffer;
  }

  /**
   * This method will read multiple strings of the buffer and return them as a
View Full Code Here

  }

  public static ChannelBuffer createBufferForOpcode(int opCode)
  {
    ChannelBuffer buffer = ChannelBuffers.buffer(1);
    buffer.writeByte(opCode);
    return buffer;
  }

  /**
   * This method will read multiple strings of the buffer and return them as a
View Full Code Here

      LOG.error("Received null message in EventEncoder");
      return msg;
    }
    Event event = (Event) msg;
    ChannelBuffer opcode = ChannelBuffers.buffer(1);
    opcode.writeByte(event.getType());
    ChannelBuffer buffer = null;
    if(null != event.getSource())
    {
      ChannelBuffer data = (ChannelBuffer) event.getSource();
      buffer = ChannelBuffers.wrappedBuffer(opcode, data);
View Full Code Here

      LOG.error("Null message received in MessageBufferEventEncoder");
      return msg;
    }
    Event event = (Event) msg;
    ChannelBuffer opcode = ChannelBuffers.buffer(1);
    opcode.writeByte(event.getType());
    ChannelBuffer buffer = null;
    if(null != event.getSource())
    {
      @SuppressWarnings("unchecked")
      MessageBuffer<ChannelBuffer> msgBuffer = (MessageBuffer<ChannelBuffer>)event.getSource();
View Full Code Here

    {
      return msg;
    }
    Event event = (Event) msg;
    ChannelBuffer opcode = ChannelBuffers.buffer(1);
    opcode.writeByte(event.getType());
    if (Events.LOG_IN == event.getType() || Events.RECONNECT == event.getType())
    {
      // write protocol version also
      ChannelBuffer protocolVersion = ChannelBuffers.buffer(1);
      protocolVersion.writeByte(Events.PROTOCOL_VERSION);
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.