當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。