io.netty.buffer.ByteBuf.readCharSequence()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(453)

本文整理了Java中io.netty.buffer.ByteBuf.readCharSequence()方法的一些代码示例,展示了ByteBuf.readCharSequence()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.readCharSequence()方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:readCharSequence

ByteBuf.readCharSequence介绍

[英]Gets a CharSequence with the given length at the current readerIndexand increases the readerIndex by the given length.
[中]获取当前readerIndex处具有给定长度的CharSequence,并将readerIndex增加给定长度。

代码示例

代码示例来源:origin: netty/netty

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: netty/netty

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: redisson/redisson

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: redisson/redisson

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: wildfly/wildfly

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: wildfly/wildfly

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return delegate.readCharSequence(length, charset);
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return byteBuf.readCharSequence(length, charset);
}

代码示例来源:origin: netty/netty

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  checkReadableBytes(length);
  return buffer.readCharSequence(length, charset);
}

代码示例来源:origin: redisson/redisson

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  checkReadableBytes(length);
  return buffer.readCharSequence(length, charset);
}

代码示例来源:origin: wildfly/wildfly

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  checkReadableBytes(length);
  return buffer.readCharSequence(length, charset);
}

代码示例来源:origin: redisson/redisson

CharSequence requestId = buf.readCharSequence(len, CharsetUtil.UTF_8);
long timeout = buf.readLong();
int hashesCount = buf.readInt();
CharSequence requestId = buf.readCharSequence(len, CharsetUtil.UTF_8);
int hashesCount = buf.readInt();
byte[][] hashes = new byte[hashesCount][];

代码示例来源:origin: redisson/redisson

CharSequence requestId = buf.readCharSequence(len, CharsetUtil.UTF_8);
long timeout = buf.readLong();
int hashesCount = buf.readInt();
CharSequence requestId = buf.readCharSequence(len, CharsetUtil.UTF_8);
int hashesCount = buf.readInt();
byte[][] hashes = new byte[hashesCount][];

代码示例来源:origin: blynkkk/blynk-server

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
  if (in.readableBytes() < 5) {
    return;
  }
  in.markReaderIndex();
  short command = in.readUnsignedByte();
  int messageId = in.readUnsignedShort();
  int codeOrLength = in.readUnsignedShort();
  if (limitChecker.quotaReached(ctx, messageId)) {
    return;
  }
  MessageBase message;
  if (command == Command.RESPONSE) {
    message = new ResponseMessage(messageId, codeOrLength);
  } else {
    if (in.readableBytes() < codeOrLength) {
      in.resetReaderIndex();
      return;
    }
    message = produce(messageId, command, (String) in.readCharSequence(codeOrLength, CharsetUtil.UTF_8));
  }
  log.trace("Incoming {}", message);
  stats.mark(command);
  out.add(message);
}

代码示例来源:origin: blynkkk/blynk-server

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
  if (in.readableBytes() < PROTOCOL_APP_HEADER_SIZE) {
    return;
  }
  in.markReaderIndex();
  short command = in.readUnsignedByte();
  int messageId = in.readUnsignedShort();
  //actually here should be long. but we do not expect this number to be large
  //so it should perfectly fit int
  int codeOrLength = (int) in.readUnsignedInt();
  if (limitChecker.quotaReached(ctx, messageId)) {
    return;
  }
  MessageBase message;
  if (command == Command.RESPONSE) {
    message = new ResponseMessage(messageId, codeOrLength);
  } else {
    if (in.readableBytes() < codeOrLength) {
      in.resetReaderIndex();
      return;
    }
    validateLength(codeOrLength);
    message = produce(messageId, command, (String) in.readCharSequence(codeOrLength, CharsetUtil.UTF_8));
  }
  log.trace("Incoming {}", message);
  stats.mark(command);
  out.add(message);
}

代码示例来源:origin: blynkkk/blynk-server

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  log.debug("In webappdecoder. {}", msg);
  if (msg instanceof BinaryWebSocketFrame) {
    try {
      ByteBuf in = ((BinaryWebSocketFrame) msg).content();
      short command = in.readUnsignedByte();
      int messageId = in.readUnsignedShort();
      if (limitChecker.quotaReached(ctx, messageId)) {
        return;
      }
      MessageBase message;
      if (command == Command.RESPONSE) {
        message = new ResponseMessage(messageId, (int) in.readUnsignedInt());
      } else {
        int codeOrLength = in.capacity() - 3;
        message = produce(messageId, command, (String) in.readCharSequence(codeOrLength, UTF_8));
      }
      log.trace("Incoming websocket msg {}", message);
      stats.markWithoutGlobal(Command.WEB_SOCKETS);
      ctx.fireChannelRead(message);
    } finally {
      ReferenceCountUtil.release(msg);
    }
  } else {
    super.channelRead(ctx, msg);
  }
}

代码示例来源:origin: traccar/traccar

String id = buf.readCharSequence(12, StandardCharsets.US_ASCII).toString();
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {

代码示例来源:origin: io.netty/netty-buffer

@Override
public CharSequence readCharSequence(int length, Charset charset) {
  return buf.readCharSequence(length, charset);
}

代码示例来源:origin: traccar/traccar

String data = buf.readCharSequence(buf.readableBytes() - 18, StandardCharsets.US_ASCII).toString();
for (String pair : data.split(",")) {
  String[] values = pair.split("=");

代码示例来源:origin: apache/tinkerpop

@Override
protected String readValue(final ByteBuf buffer, final GraphBinaryReader context) {
  final int length = buffer.readInt();
  return buffer.readCharSequence(length, StandardCharsets.UTF_8).toString();
}

相关文章

ByteBuf类方法