Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.writeInt()


        ByteBuf out = buf.order(ByteOrder.LITTLE_ENDIAN);

        out.writeInt(0); // write length later

        out.writeInt(reply.getHeader().getRequestID());
        out.writeInt(reply.getHeader().getResponseTo());
        out.writeInt(OpCode.OP_REPLY.getId());

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
View Full Code Here


        ByteBuf out = buf.order(ByteOrder.LITTLE_ENDIAN);

        out.writeInt(0); // write length later

        out.writeInt(reply.getHeader().getRequestID());
        out.writeInt(reply.getHeader().getResponseTo());
        out.writeInt(OpCode.OP_REPLY.getId());

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
        out.writeInt(reply.getStartingFrom());
View Full Code Here

        out.writeInt(0); // write length later

        out.writeInt(reply.getHeader().getRequestID());
        out.writeInt(reply.getHeader().getResponseTo());
        out.writeInt(OpCode.OP_REPLY.getId());

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
        out.writeInt(reply.getStartingFrom());
        final List<BSONObject> documents = reply.getDocuments();
View Full Code Here

        out.writeInt(reply.getHeader().getRequestID());
        out.writeInt(reply.getHeader().getResponseTo());
        out.writeInt(OpCode.OP_REPLY.getId());

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
        out.writeInt(reply.getStartingFrom());
        final List<BSONObject> documents = reply.getDocuments();
        out.writeInt(documents.size());
View Full Code Here

        out.writeInt(reply.getHeader().getResponseTo());
        out.writeInt(OpCode.OP_REPLY.getId());

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
        out.writeInt(reply.getStartingFrom());
        final List<BSONObject> documents = reply.getDocuments();
        out.writeInt(documents.size());

        for (final BSONObject bsonObject : documents) {
            out.writeBytes(BSON.encode(bsonObject));
View Full Code Here

        out.writeInt(reply.getFlags());
        out.writeLong(reply.getCursorId());
        out.writeInt(reply.getStartingFrom());
        final List<BSONObject> documents = reply.getDocuments();
        out.writeInt(documents.size());

        for (final BSONObject bsonObject : documents) {
            out.writeBytes(BSON.encode(bsonObject));
        }
View Full Code Here

    }
   
    private void sendMessage(ChannelHandlerContext ctx, String config) {
      byte[] bytes = config.getBytes(charset);
      ByteBuf message = Unpooled.buffer(4 + bytes.length);
        message.writeInt(bytes.length);
        message.writeBytes(bytes);
        ctx.writeAndFlush(message);
  }
   
    public static class ClientInfo {
View Full Code Here

                           BEGINNING_SPACE.matcher(key1).replaceAll("").length());
            int b = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key2).replaceAll("")) /
                           BEGINNING_SPACE.matcher(key2).replaceAll("").length());
            long c = req.data().readLong();
            ByteBuf input = Unpooled.buffer(16);
            input.writeInt(a);
            input.writeInt(b);
            input.writeLong(c);
            res.data().writeBytes(WebSocketUtil.md5(input.array()));
        } else {
            // Old Hixie 75 handshake getMethod with no challenge:
View Full Code Here

            int b = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key2).replaceAll("")) /
                           BEGINNING_SPACE.matcher(key2).replaceAll("").length());
            long c = req.data().readLong();
            ByteBuf input = Unpooled.buffer(16);
            input.writeInt(a);
            input.writeInt(b);
            input.writeLong(c);
            res.data().writeBytes(WebSocketUtil.md5(input.array()));
        } else {
            // Old Hixie 75 handshake getMethod with no challenge:
            res.headers().add(WEBSOCKET_ORIGIN, req.headers().get(ORIGIN));
View Full Code Here

            /* write out IDs in this block */
            ByteBuf metaBuffer = PooledByteBufAllocator.DEFAULT.directBuffer(2 + 4 * streams + 4 + 8 * streams);
            metaBuffer.writeShort(streams);
            int bodyOutputSize = 0;
            for (TempData out : streamsWithData) {
                metaBuffer.writeInt(out.meta.streamID);
                /* (4) chunk body offset (4) chunk length (n) chunk bytes */
                bodyOutputSize += 8 + out.snapshotLength;
            }
            /* write remainder size for rest of block data so that readers can skip if desired ID isn't present */
            metaBuffer.writeInt(bodyOutputSize);
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.