Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.BigEndianHeapChannelBuffer.readableBytes()


        message.writeTo(output);
        output.checkNoSpaceLeft();

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


        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());

        return buffer;
    }
}
View Full Code Here

        // add optional parameters (a noop if none exist)
        pdu.writeOptionalParameters(buffer, context);

        // NOTE: at this point, the entire buffer written MUST match the command length
        // from earlier -- if it doesn't match, the our encoding process went awry
        if (buffer.readableBytes() != pdu.getCommandLength()) {
            throw new NotEnoughDataInBufferException("During PDU encoding the expected commandLength did not match the actual encoded (a serious error with our own encoding process)", pdu.getCommandLength(), buffer.readableBytes());
        }

        return buffer;
    }
View Full Code Here

        pdu.writeOptionalParameters(buffer, context);

        // NOTE: at this point, the entire buffer written MUST match the command length
        // from earlier -- if it doesn't match, the our encoding process went awry
        if (buffer.readableBytes() != pdu.getCommandLength()) {
            throw new NotEnoughDataInBufferException("During PDU encoding the expected commandLength did not match the actual encoded (a serious error with our own encoding process)", pdu.getCommandLength(), buffer.readableBytes());
        }

        return buffer;
    }
   
View Full Code Here

        // add optional parameters (a noop if none exist)
        pdu.writeOptionalParameters(buffer, context);

        // NOTE: at this point, the entire buffer written MUST match the command length
        // from earlier -- if it doesn't match, the our encoding process went awry
        if (buffer.readableBytes() != pdu.getCommandLength()) {
            throw new NotEnoughDataInBufferException("During PDU encoding the expected commandLength did not match the actual encoded (a serious error with our own encoding process)", pdu.getCommandLength(), buffer.readableBytes());
        }

        return buffer;
    }
View Full Code Here

        pdu.writeOptionalParameters(buffer, context);

        // NOTE: at this point, the entire buffer written MUST match the command length
        // from earlier -- if it doesn't match, the our encoding process went awry
        if (buffer.readableBytes() != pdu.getCommandLength()) {
            throw new NotEnoughDataInBufferException("During PDU encoding the expected commandLength did not match the actual encoded (a serious error with our own encoding process)", pdu.getCommandLength(), buffer.readableBytes());
        }

        return buffer;
    }
   
View Full Code Here

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        BigEndianHeapChannelBuffer message = (BigEndianHeapChannelBuffer) e.getMessage();
        // System.out.println("messageReceived " + ctx.getChannel() + message.readableBytes());
        received += message.readableBytes();
        digest.update(message.array(), message.readerIndex(), message.readableBytes());
        if (received > maxLength) {
            System.out.println("messageReceived tid=" + Thread.currentThread().getId()
                    + " " + id + " got " + received);
            ctx.getChannel().close();
View Full Code Here

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        BigEndianHeapChannelBuffer message = (BigEndianHeapChannelBuffer) e.getMessage();
        // System.out.println("messageReceived " + ctx.getChannel() + message.readableBytes());
        received += message.readableBytes();
        digest.update(message.array(), message.readerIndex(), message.readableBytes());
        if (received > maxLength) {
            System.out.println("messageReceived tid=" + Thread.currentThread().getId()
                    + " " + id + " got " + received);
            ctx.getChannel().close();
        }
View Full Code Here

        message.writeTo(output);
        output.checkNoSpaceLeft();

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

        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());

        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.