当前位置: 首页>>代码示例>>Java>>正文


Java ByteBuf.readLong方法代码示例

本文整理汇总了Java中io.netty.buffer.ByteBuf.readLong方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBuf.readLong方法的具体用法?Java ByteBuf.readLong怎么用?Java ByteBuf.readLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.buffer.ByteBuf的用法示例。


在下文中一共展示了ByteBuf.readLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readHead

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private void readHead(ByteBuf in) {
    if (in.readableBytes() < FastdfsConstants.FDFS_HEAD_LEN) {
        return;
    }
    length = in.readLong();
    byte cmd = in.readByte();
    byte errno = in.readByte();
    if (errno != 0) {
        if (errno == FastDFSResponseCode.ERR_NO_ENOENT)
        {
            throw new FastdfsNotFoundException();
        }
        throw new FastdfsException("Fastdfs responsed with an error, errno is " + errno);
    }
    if (cmd != RESP) {
        throw new FastdfsException("Expect response command code error : " + cmd);
    }
    long expectLength = expectLength();
    if (expectLength >= 0 && length != expectLength) {
        throw new FastdfsException("Expect response length : " + expectLength + " , but reply length : " + length);
    }
    atHead = false;
}
 
开发者ID:rodbate,项目名称:fastdfs-spring-boot,代码行数:24,代码来源:ReplierSupport.java

示例2: ActionOptions

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public ActionOptions(ByteBuf buf) {
    int size = buf.readInt();
    actionOptions = new ArrayList<>();
    while (size > 0) {
        actionOptions.add(new MeeCreepActionType(NetworkTools.readStringUTF8(buf)));
        size--;
    }
    size = buf.readInt();
    maybeActionOptions = new ArrayList<>();
    while (size > 0) {
        maybeActionOptions.add(new MeeCreepActionType(NetworkTools.readStringUTF8(buf)));
        size--;
    }
    targetPos = NetworkTools.readPos(buf);
    targetSide = EnumFacing.VALUES[buf.readByte()];
    dimension = buf.readInt();
    if (buf.readBoolean()) {
        playerId = new UUID(buf.readLong(), buf.readLong());
    } else {
        playerId = null;
    }
    actionId = buf.readInt();
    timeout = buf.readInt();
    stage = Stage.values()[buf.readByte()];
    if (buf.readBoolean()) {
        task = new MeeCreepActionType(NetworkTools.readStringUTF8(buf));
    }
    furtherQuestionId = NetworkTools.readStringUTF8(buf);
    paused = buf.readBoolean();

    // Drops not needed on client so no persistance
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:33,代码来源:ActionOptions.java

示例3: deserialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void deserialize(ByteBuf buf) {
  int resultSize = buf.readInt();
  result = new double[resultSize];
  for (int i = 0; i < resultSize; i++) {
    result[i] = buf.readDouble();
  }

  int colSize = buf.readInt();
  cols = new long[colSize];
  for (int i = 0; i < colSize; i++) {
    cols[i] = buf.readLong();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:15,代码来源:ArrayPartitionAggrResult.java

示例4: fromBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
    worldID = buf.readInt();
    nanos = buf.readLong();
    name = ByteBufUtils.readUTF8String(buf);
    className = ByteBufUtils.readUTF8String(buf);
    isTileEntity = buf.readBoolean();
    if(isTileEntity){
        x = buf.readInt();
        y = buf.readInt();
        z = buf.readInt();
    }else {
        id = UUID.fromString(ByteBufUtils.readUTF8String(buf));
    }
}
 
开发者ID:TerminatorNL,项目名称:LagGoggles,代码行数:16,代码来源:ScanResult.java

示例5: receiveHandshakeOption

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private void receiveHandshakeOption(ChannelHandlerContext ctx, ByteBuf message) throws IOException {

        final long ihaveopt = message.readLong();
        if (ihaveopt != Protocol.IHAVEOPT)
            throw new IllegalArgumentException("Invalid negotiation magic != 'IHAVEOPT'");

        int option = message.readInt();
        long optionLen = message.readUnsignedInt();

        currentOption = option;
        currentOptionLen = optionLen;
        LOGGER.debug("currentOption {} currentOptionLen {}", currentOption, currentOptionLen);
        state = State.HS_OPTION_DATA;
    }
 
开发者ID:MineboxOS,项目名称:minebox,代码行数:15,代码来源:HandshakePhase.java

示例6: decode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static UserInfo decode(ByteBuf in) {
	UserInfo userInfo = new UserInfo();
	userInfo.uid = in.readLong();
	userInfo.cid = in.readInt();
	userInfo.eid = in.readInt();
	return userInfo;
}
 
开发者ID:inspingcc,项目名称:LibraSock,代码行数:8,代码来源:UserInfo.java

示例7: decodeFrameSize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private long decodeFrameSize() {
  if (nextFrameSize != UNKNOWN_FRAME_SIZE || totalSize < LENGTH_SIZE) {
    return nextFrameSize;
  }

  // We know there's enough data. If the first buffer contains all the data, great. Otherwise,
  // hold the bytes for the frame length in a composite buffer until we have enough data to read
  // the frame size. Normally, it should be rare to need more than one buffer to read the frame
  // size.
  ByteBuf first = buffers.getFirst();
  if (first.readableBytes() >= LENGTH_SIZE) {
    nextFrameSize = first.readLong() - LENGTH_SIZE;
    totalSize -= LENGTH_SIZE;
    if (!first.isReadable()) {
      buffers.removeFirst().release();
    }
    return nextFrameSize;
  }

  while (frameLenBuf.readableBytes() < LENGTH_SIZE) {
    ByteBuf next = buffers.getFirst();
    int toRead = Math.min(next.readableBytes(), LENGTH_SIZE - frameLenBuf.readableBytes());
    frameLenBuf.writeBytes(next, toRead);
    if (!next.isReadable()) {
      buffers.removeFirst().release();
    }
  }

  nextFrameSize = frameLenBuf.readLong() - LENGTH_SIZE;
  totalSize -= LENGTH_SIZE;
  frameLenBuf.clear();
  return nextFrameSize;
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:34,代码来源:TransportFrameDecoder.java

示例8: fromBuffer

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void fromBuffer(ByteBuf buf) throws IOException{
    this.playerId = new UUID(buf.readLong(), buf.readLong());

    DataSet set = new DataSet();
    NetUtil.readSetFromBuffer(set, buf);
    this.instance = ItemInstance.load(set);
}
 
开发者ID:RockBottomGame,项目名称:API,代码行数:9,代码来源:PacketDropItem.java

示例9: fromBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
	target = new UUID(buf.readLong(), buf.readLong());
	int size = buf.readInt();

	effects = new LinkedHashMap<>(size);

	for (int i = 0; i < size; i++) {
		IBrew brew = BrewRegistry.getBrew(buf.readInt());
		effects.put(brew, new BrewEffect(brew, buf.readInt(), buf.readInt()));
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:13,代码来源:BrewMessage.java

示例10: OperationParameters

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private OperationParameters(ByteBuf message) {
    cmdFlags = message.readShort();
    cmdType = message.readShort();
    cmdHandle = message.readLong();
    cmdOffset = message.readLong();
    cmdLength = message.readUnsignedInt();
    state = State.TM_RECEIVE_CMD_DATA;
}
 
开发者ID:MineboxOS,项目名称:tools,代码行数:9,代码来源:OperationParameters.java

示例11: decode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public QueryOptions decode(ByteBuf body, ProtocolVersion version)
{
    ConsistencyLevel consistency = CBUtil.readConsistencyLevel(body);
    EnumSet<Flag> flags = Flag.deserialize(version.isGreaterOrEqualTo(ProtocolVersion.V5)
                                           ? (int)body.readUnsignedInt()
                                           : (int)body.readByte());

    List<ByteBuffer> values = Collections.<ByteBuffer>emptyList();
    List<String> names = null;
    if (flags.contains(Flag.VALUES))
    {
        if (flags.contains(Flag.NAMES_FOR_VALUES))
        {
            Pair<List<String>, List<ByteBuffer>> namesAndValues = CBUtil.readNameAndValueList(body, version);
            names = namesAndValues.left;
            values = namesAndValues.right;
        }
        else
        {
            values = CBUtil.readValueList(body, version);
        }
    }

    boolean skipMetadata = flags.contains(Flag.SKIP_METADATA);
    flags.remove(Flag.VALUES);
    flags.remove(Flag.SKIP_METADATA);

    SpecificOptions options = SpecificOptions.DEFAULT;
    if (!flags.isEmpty())
    {
        int pageSize = flags.contains(Flag.PAGE_SIZE) ? body.readInt() : -1;
        PagingState pagingState = flags.contains(Flag.PAGING_STATE) ? PagingState.deserialize(CBUtil.readValue(body), version) : null;
        ConsistencyLevel serialConsistency = flags.contains(Flag.SERIAL_CONSISTENCY) ? CBUtil.readConsistencyLevel(body) : ConsistencyLevel.SERIAL;
        long timestamp = Long.MIN_VALUE;
        if (flags.contains(Flag.TIMESTAMP))
        {
            long ts = body.readLong();
            if (ts == Long.MIN_VALUE)
                throw new ProtocolException(String.format("Out of bound timestamp, must be in [%d, %d] (got %d)", Long.MIN_VALUE + 1, Long.MAX_VALUE, ts));
            timestamp = ts;
        }

        options = new SpecificOptions(pageSize, pagingState, serialConsistency, timestamp);
    }
    DefaultQueryOptions opts = new DefaultQueryOptions(consistency, values, skipMetadata, options, version);
    return names == null ? opts : new OptionsWithNames(opts, names);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:48,代码来源:QueryOptions.java

示例12: decode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static org.apache.spark.network.protocol.StreamResponse decode(ByteBuf buf) {
  String streamId = Encoders.Strings.decode(buf);
  long byteCount = buf.readLong();
  return new org.apache.spark.network.protocol.StreamResponse(streamId, byteCount, null);
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:6,代码来源:StreamResponse.java

示例13: decode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static org.apache.spark.network.protocol.RpcFailure decode(ByteBuf buf) {
  long requestId = buf.readLong();
  String errorString = Encoders.Strings.decode(buf);
  return new org.apache.spark.network.protocol.RpcFailure(requestId, errorString);
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:6,代码来源:RpcFailure.java

示例14: decode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static org.apache.spark.network.protocol.RpcRequest decode(ByteBuf buf) {
  long requestId = buf.readLong();
  // See comment in encodedLength().
  buf.readInt();
  return new org.apache.spark.network.protocol.RpcRequest(requestId, new NettyManagedBuffer(buf.retain()));
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:7,代码来源:RpcRequest.java

示例15: read

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void read( ByteBuf buf ) throws IOException {
    payload = buf.readLong();
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:MessageC01Ping.java


注:本文中的io.netty.buffer.ByteBuf.readLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。