本文整理匯總了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;
}
示例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
}
示例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();
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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()));
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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()));
}
示例15: read
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
@Override
public void read( ByteBuf buf ) throws IOException {
payload = buf.readLong();
}