Package org.jboss.netty.buffer

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


            // correctly size the last chunk
            if (sequenceNumber + 1 == sequenceCount) {
                payloadSize = (messageSize % maxChunkSize);
            }
            final ChannelBuffer payload = ChannelBuffers.buffer(payloadSize);
            payload.writeZero(payloadSize);

            buffers[sequenceNumber] = ChannelBuffers.copiedBuffer(
                    CHUNK_MAGIC_BYTES,
                    messageId,
                    sequenceNumberArry,
View Full Code Here


    public ChannelBuffer build() {
        ChannelBuffer res = ChannelBuffers.dynamicBuffer();
        res.writeInt(channelBuffer.readableBytes());
        res.writeBytes(channelBuffer);
        res.writeZero(4);
        return res;
    }

    int getTime() {
        int res = timer;
View Full Code Here

        String name = message.getDescriptorForType().getFullName();
        int size = message.getSerializedSize();
        ChannelBuffer buffer = new BigEndianHeapChannelBuffer(4 + name.length() + 1 + size + 4);
        buffer.writeInt(name.length() + 1);
        buffer.writeBytes(name.getBytes());
        buffer.writeZero(1);
        buffer.writeBytes(message.toByteArray());

        Adler32 checksum = new Adler32();
        checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
        buffer.writeInt((int) checksum.getValue());
View Full Code Here

        reply.writeInt((int) deviceId);
        reply.writeByte(commandCount++);
        reply.writeInt(0); // authentication code
        reply.writeByte(0);
        reply.writeByte(packetNumber);
        reply.writeZero(10);

        byte checksum = 0;
        for (int i = 4; i < 27; i++) {
            checksum += reply.getByte(i);
        }
View Full Code Here

        String name = message.getDescriptorForType().getFullName();
        int size = message.getSerializedSize();
        ChannelBuffer buffer = new BigEndianHeapChannelBuffer(4 + name.length() + 1 + size + 4);
        buffer.writeInt(name.length() + 1);
        buffer.writeBytes(name.getBytes());
        buffer.writeZero(1);
        buffer.writeBytes(message.toByteArray());

        Adler32 checksum = new Adler32();
        checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
        buffer.writeInt((int) checksum.getValue());
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.