List of usage examples for io.netty.buffer ByteBuf readLong
public abstract long readLong();
From source file:com.Da_Technomancer.crossroads.API.packets.Message.java
License:Creative Commons License
private static long readLong(ByteBuf buf) { return buf.readLong(); }
From source file:com.Da_Technomancer.crossroads.API.packets.Message.java
License:Creative Commons License
private static BlockPos readBlockPos(ByteBuf buf) { return BlockPos.fromLong(buf.readLong()); }
From source file:com.eightkdata.mongowp.bson.netty.DefaultNettyBsonLowLevelReader.java
License:Open Source License
@Override BsonDateTime readDateTime(@Loose @ModifiesIndexes ByteBuf byteBuf) { return new LongBsonDateTime(byteBuf.readLong()); }
From source file:com.eightkdata.mongowp.bson.netty.DefaultNettyBsonLowLevelReader.java
License:Open Source License
@Override BsonInt64 readInt64(@Loose @ModifiesIndexes ByteBuf byteBuf) { return PrimitiveBsonInt64.newInstance(byteBuf.readLong()); }
From source file:com.eightkdata.mongowp.mongoserver.decoder.GetMoreMessageDecoder.java
License:Open Source License
@Override public @Nonnegative GetMoreMessage decode(ByteBuf buffer, RequestBaseMessage requestBaseMessage) throws InvalidMessageException { buffer.skipBytes(4);// w w w .j a v a 2s .c om String fullCollectionName = ByteBufUtil.readCString(buffer); int numberToReturn = buffer.readInt(); long cursorId = buffer.readLong(); return new GetMoreMessage(requestBaseMessage, fullCollectionName, numberToReturn, cursorId); }
From source file:com.eightkdata.mongowp.mongoserver.decoder.KillCursorsMessageDecoder.java
License:Open Source License
@Override public @Nonnegative KillCursorsMessage decode(ByteBuf buffer, RequestBaseMessage requestBaseMessage) throws InvalidMessageException { buffer.skipBytes(4);/*from ww w. j av a 2 s . c o m*/ int numberOfCursors = buffer.readInt(); long[] cursorIds = new long[numberOfCursors]; for (int index = 0; index < numberOfCursors; index++) { cursorIds[index] = buffer.readLong(); } return new KillCursorsMessage(requestBaseMessage, numberOfCursors, cursorIds); }
From source file:com.eightkdata.mongowp.server.decoder.GetMoreMessageDecoder.java
License:Open Source License
@Override public GetMoreMessage decode(ByteBuf buffer, RequestBaseMessage requestBaseMessage) throws InvalidNamespaceException, InvalidBsonException { try {//w w w . jav a 2 s . c o m buffer.skipBytes(4); String fullCollectionName = stringReader.readCString(buffer, true); int numberToReturn = buffer.readInt(); long cursorId = buffer.readLong(); //TODO: improve the way database and cache are pooled return new GetMoreMessage(requestBaseMessage, getDatabase(fullCollectionName).intern(), getCollection(fullCollectionName).intern(), numberToReturn, cursorId); } catch (NettyBsonReaderException ex) { throw new InvalidBsonException(ex); } }
From source file:com.eightkdata.mongowp.server.decoder.KillCursorsMessageDecoder.java
License:Open Source License
@Override public KillCursorsMessage decode(ByteBuf buffer, RequestBaseMessage requestBaseMessage) throws InvalidNamespaceException { buffer.skipBytes(4);//from w ww .j a va 2 s .c om int numberOfCursors = buffer.readInt(); long[] cursorIds = new long[numberOfCursors]; for (int index = 0; index < numberOfCursors; index++) { cursorIds[index] = buffer.readLong(); } return new KillCursorsMessage(requestBaseMessage, numberOfCursors, cursorIds); }
From source file:com.example.pojo.client.ServerTimeDecoder.java
License:Apache License
@Override protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List<Object> out) { final int readableBytes = in.readableBytes(); log.info("read bytes size: {}", readableBytes); if (readableBytes >= 8) { out.add(new ServerTime(in.readLong())); }//w w w . jav a 2 s. co m }
From source file:com.example.time.client.TimeClientHandler.java
License:Apache License
@Override public void channelRead(final ChannelHandlerContext ctx, final Object msg) { final ByteBuf byteBuf = (ByteBuf) msg; try (final GracefulShutdown ignored = GracefulShutdown.gracefulShutdown(byteBuf::release)) { final long epochSeconds = byteBuf.readLong(); final OffsetDateTime serverTime = Instant.ofEpochSecond(epochSeconds).atOffset(ZoneOffset.UTC); log.info("server time: {}", serverTime); ctx.close();/*from ww w . ja v a2 s.c o m*/ } }