Examples of readerIndex()


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

                        channel.currentWriteEvent = null;
                        removeOpWrite = true;
                        break;
                    }
                    buf = (ChannelBuffer) evt.getMessage();
                    bufIdx = buf.readerIndex();
                } else {
                    buf = (ChannelBuffer) evt.getMessage();
                    bufIdx = channel.currentWriteIndex;
                }
View Full Code Here

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

        }

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite =
            new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        synchronized (pendingUnencryptedWrites) {
            pendingUnencryptedWrites.offer(pendingWrite);
        }

        wrap(context, evt.getChannel());
View Full Code Here

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

     * Stores the internal cumulative buffer's reader position.
     */
    protected void checkpoint() {
        ChannelBuffer cumulation = this.cumulation.get();
        if (cumulation != null) {
            checkpoint = cumulation.readerIndex();
        } else {
            checkpoint = -1; // buffer not available (already cleaned up)
        }
    }

View Full Code Here

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

    public Object decode(ChannelHandlerContext ctx, Channel channel, Object obj)
            throws Exception {
        if (obj instanceof ChannelBuffer) {
            ChannelBuffer buffer = (ChannelBuffer) obj;
            if (buffer.readableBytes() > 8) {
                String version = buffer.toString(buffer.readerIndex(), 4, Charset.defaultCharset());
                if (version.equals("RPC0")) {
                    Adler32 adler32 = new Adler32();
                    adler32.update(buffer.array(),
                            buffer.arrayOffset() + buffer.readerIndex(),
                            buffer.readableBytes() - 4);
View Full Code Here

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

            if (buffer.readableBytes() > 8) {
                String version = buffer.toString(buffer.readerIndex(), 4, Charset.defaultCharset());
                if (version.equals("RPC0")) {
                    Adler32 adler32 = new Adler32();
                    adler32.update(buffer.array(),
                            buffer.arrayOffset() + buffer.readerIndex(),
                            buffer.readableBytes() - 4);
                    buffer.markReaderIndex();
                    buffer.readerIndex(buffer.writerIndex() - 4);
                    int checksum = buffer.readInt();
                    if (checksum == (int)adler32.getValue()) {
View Full Code Here

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

                    Adler32 adler32 = new Adler32();
                    adler32.update(buffer.array(),
                            buffer.arrayOffset() + buffer.readerIndex(),
                            buffer.readableBytes() - 4);
                    buffer.markReaderIndex();
                    buffer.readerIndex(buffer.writerIndex() - 4);
                    int checksum = buffer.readInt();
                    if (checksum == (int)adler32.getValue()) {
                        buffer.resetReaderIndex();
                        RpcMessage message = RpcMessage.newBuilder().mergeFrom(
                                buffer.array(),
View Full Code Here

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

                    int checksum = buffer.readInt();
                    if (checksum == (int)adler32.getValue()) {
                        buffer.resetReaderIndex();
                        RpcMessage message = RpcMessage.newBuilder().mergeFrom(
                                buffer.array(),
                                buffer.arrayOffset() + buffer.readerIndex() + 4,
                                buffer.readableBytes() - 8).build();
                        return message;
                    }
                }
            }
View Full Code Here

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

            return obj;
        }
        ChannelBuffer buffer = (ChannelBuffer) obj;
        if (buffer.readableBytes() >= 10 && checksum(buffer)) {
            int nameLen = buffer.readInt();
            String typeName = buffer.toString(buffer.readerIndex(), nameLen - 1,
                    Charset.defaultCharset());
            buffer.readerIndex(buffer.readerIndex() + nameLen);
            Message prototype = knownTypes.get(typeName);
            if (prototype != null) {
                return prototype.newBuilderForType().mergeFrom(buffer.array(),
View Full Code Here

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

        ChannelBuffer buffer = (ChannelBuffer) obj;
        if (buffer.readableBytes() >= 10 && checksum(buffer)) {
            int nameLen = buffer.readInt();
            String typeName = buffer.toString(buffer.readerIndex(), nameLen - 1,
                    Charset.defaultCharset());
            buffer.readerIndex(buffer.readerIndex() + nameLen);
            Message prototype = knownTypes.get(typeName);
            if (prototype != null) {
                return prototype.newBuilderForType().mergeFrom(buffer.array(),
                        buffer.arrayOffset() + buffer.readerIndex(),
                        buffer.readableBytes() - 4).build();
View Full Code Here

Examples of org.jboss.netty.buffer.CompositeChannelBuffer.readerIndex()

    protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
        Object retVal = super.encode(ctx, channel, msg);
        if (retVal instanceof CompositeChannelBuffer) {
            CompositeChannelBuffer ccb = (CompositeChannelBuffer) retVal;
            if (ccb.useGathering() != NettyUtils.DEFAULT_GATHERING) {
                List<ChannelBuffer> decompose = ccb.decompose(ccb.readerIndex(), ccb.readableBytes());
                return ChannelBuffers.wrappedBuffer(NettyUtils.DEFAULT_GATHERING,
                        decompose.toArray(new ChannelBuffer[decompose.size()]));
            }
        }
        return retVal;
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.