Package org.jboss.netty.buffer

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


            SpdyGoAwayFrame spdyGoAwayFrame = (SpdyGoAwayFrame) msg;
            int length = version < 3 ? 4 : 8;
            ChannelBuffer frame = ChannelBuffers.buffer(
                    ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + length);
            frame.writeShort(version | 0x8000);
            frame.writeShort(SPDY_GOAWAY_FRAME);
            frame.writeInt(length);
            frame.writeInt(spdyGoAwayFrame.getLastGoodStreamId());
            if (version >= 3) {
                frame.writeInt(spdyGoAwayFrame.getStatus().getCode());
            }
View Full Code Here


                } else {
                    length = 4 + headerBlockLength;
                }
                ChannelBuffer frame = ChannelBuffers.buffer(
                        ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + length);
                frame.writeShort(version | 0x8000);
                frame.writeShort(SPDY_HEADERS_FRAME);
                frame.writeByte(flags);
                frame.writeMedium(length);
                frame.writeInt(spdyHeadersFrame.getStreamId());
                if (version < 3 && data.readableBytes() != 0) {
View Full Code Here

                    length = 4 + headerBlockLength;
                }
                ChannelBuffer frame = ChannelBuffers.buffer(
                        ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + length);
                frame.writeShort(version | 0x8000);
                frame.writeShort(SPDY_HEADERS_FRAME);
                frame.writeByte(flags);
                frame.writeMedium(length);
                frame.writeInt(spdyHeadersFrame.getStreamId());
                if (version < 3 && data.readableBytes() != 0) {
                    frame.writeShort(0);
View Full Code Here

                frame.writeShort(SPDY_HEADERS_FRAME);
                frame.writeByte(flags);
                frame.writeMedium(length);
                frame.writeInt(spdyHeadersFrame.getStreamId());
                if (version < 3 && data.readableBytes() != 0) {
                    frame.writeShort(0);
                }
                // Writes of compressed data must occur in order
                final ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(frame, data);
                Channels.write(ctx, e.getFuture(), buffer, e.getRemoteAddress());
            }
View Full Code Here

        if (msg instanceof SpdyWindowUpdateFrame) {
            SpdyWindowUpdateFrame spdyWindowUpdateFrame = (SpdyWindowUpdateFrame) msg;
            ChannelBuffer frame = ChannelBuffers.buffer(
                    ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + 8);
            frame.writeShort(version | 0x8000);
            frame.writeShort(SPDY_WINDOW_UPDATE_FRAME);
            frame.writeInt(8);
            frame.writeInt(spdyWindowUpdateFrame.getStreamId());
            frame.writeInt(spdyWindowUpdateFrame.getDeltaWindowSize());
            Channels.write(ctx, e.getFuture(), frame, e.getRemoteAddress());
View Full Code Here

      for (int i2 = 0; i2 < 5; i2++) {
        byte[] rk = new byte[10];

        ChannelBuffer buf = ChannelBuffers.wrappedBuffer(rk);
        buf.clear();
        buf.writeShort((short) 2);
        buf.writeInt(i1);
        buf.writeInt(i2);

        for (int c = 0; c < 5; c++) {
          byte[] cq = new byte[4];
View Full Code Here

  private void runTest(HTable hTable, int cqStart, int expectedSize) throws IOException {
    // [0, 2, ?, ?, ?, ?, 0, 0, 0, 1]
    byte[] fuzzyKey = new byte[10];
    ChannelBuffer buf = ChannelBuffers.wrappedBuffer(fuzzyKey);
    buf.clear();
    buf.writeShort((short) 2);
    for (int i = 0; i < 4; i++)
      buf.writeByte((short)63);
    buf.writeInt((short)1);

    byte[] mask = new byte[] {0 , 0, 1, 1, 1, 1, 0, 0, 0, 0};
View Full Code Here

    }

    public static ChannelBuffer shortToCB(int s)
    {
        ChannelBuffer cb = ChannelBuffers.buffer(2);
        cb.writeShort(s);
        return cb;
    }

    public static ChannelBuffer byteToCB(byte b)
    {
View Full Code Here

    }

    public static ChannelBuffer shortToCB(int s)
    {
        ChannelBuffer cb = ChannelBuffers.buffer(2);
        cb.writeShort(s);
        return cb;
    }

    public static ChannelBuffer intToCB(int i)
    {
View Full Code Here

    {
        int optLength = 2;
        for (Map.Entry<T, Object> entry : options.entrySet())
            optLength += 2 + entry.getKey().serializedValueSize(entry.getValue());
        ChannelBuffer cb = ChannelBuffers.buffer(optLength);
        cb.writeShort(options.size());
        for (Map.Entry<T, Object> entry : options.entrySet())
        {
            T opt = entry.getKey();
            cb.writeShort(opt.getId());
            opt.writeValue(entry.getValue(), cb);
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.