Package org.jboss.netty.buffer

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


        frames.writeInt(random.nextInt() & 0x7FFFFFFF | 0x01);

        // SPDY WINDOW_UPDATE Frame
        frames.writeByte(0x80);
        frames.writeByte(version);
        frames.writeShort(9);
        frames.writeInt(8);
        frames.writeInt(random.nextInt() & 0x7FFFFFFF | 0x01);
        frames.writeInt(random.nextInt() & 0x7FFFFFFF | 0x01);

        return frames;
View Full Code Here


    // Write the class name of the object.
    // See hadoop.io.ObjectWritable#writeObject
    // See hadoop.io.UTF8#writeString
    // String length as a short followed by UTF-8 string.
    String klass = "org.apache.hadoop.io.Writable";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 29
    klass = "org.apache.hadoop.io.ObjectWritable$NullInstance";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 48
    klass = "org.apache.hadoop.security.UserGroupInformation";
View Full Code Here

    // String length as a short followed by UTF-8 string.
    String klass = "org.apache.hadoop.io.Writable";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 29
    klass = "org.apache.hadoop.io.ObjectWritable$NullInstance";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 48
    klass = "org.apache.hadoop.security.UserGroupInformation";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 47
View Full Code Here

    header.writeBytes(Bytes.ISO88591(klass));                 // 29
    klass = "org.apache.hadoop.io.ObjectWritable$NullInstance";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 48
    klass = "org.apache.hadoop.security.UserGroupInformation";
    header.writeShort(klass.length());                        // 2
    header.writeBytes(Bytes.ISO88591(klass));                 // 47

    // Now set the length of the whole damn thing.
    // -4 because the length itself isn't part of the payload.
    // -5 because the "hrpc" + version isn't part of the payload.
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());
            return;
View Full Code Here

                } else {
                    length = 10 + headerBlockLength;
                }
                ChannelBuffer frame = ChannelBuffers.buffer(
                        ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + 12);
                frame.writeShort(version | 0x8000);
                frame.writeShort(SPDY_SYN_STREAM_FRAME);
                frame.writeByte(flags);
                frame.writeMedium(length);
                frame.writeInt(spdySynStreamFrame.getStreamId());
                frame.writeInt(spdySynStreamFrame.getAssociatedToStreamId());
View Full Code Here

                    length = 10 + headerBlockLength;
                }
                ChannelBuffer frame = ChannelBuffers.buffer(
                        ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + 12);
                frame.writeShort(version | 0x8000);
                frame.writeShort(SPDY_SYN_STREAM_FRAME);
                frame.writeByte(flags);
                frame.writeMedium(length);
                frame.writeInt(spdySynStreamFrame.getStreamId());
                frame.writeInt(spdySynStreamFrame.getAssociatedToStreamId());
                if (version < 3) {
View Full Code Here

                    // Restrict priorities for SPDY/2 to between 0 and 3
                    byte priority = spdySynStreamFrame.getPriority();
                    if (priority > 3) {
                        priority = 3;
                    }
                    frame.writeShort((priority & 0xFF) << 14);
                } else {
                    frame.writeShort((spdySynStreamFrame.getPriority() & 0xFF) << 13);
                }
                if (version < 3 && data.readableBytes() == 0) {
                    frame.writeShort(0);
View Full Code Here

                    if (priority > 3) {
                        priority = 3;
                    }
                    frame.writeShort((priority & 0xFF) << 14);
                } else {
                    frame.writeShort((spdySynStreamFrame.getPriority() & 0xFF) << 13);
                }
                if (version < 3 && data.readableBytes() == 0) {
                    frame.writeShort(0);
                }
                // Writes of compressed data must occur in order
View Full Code Here

                    frame.writeShort((priority & 0xFF) << 14);
                } else {
                    frame.writeShort((spdySynStreamFrame.getPriority() & 0xFF) << 13);
                }
                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

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.