com.couchbase.client.deps.io.netty.buffer.ByteBuf.readByte()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(171)

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

ByteBuf.readByte介绍

[英]Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
[中]在当前readerIndex处获取一个字节,并在此缓冲区中将readerIndex增加1。

代码示例

代码示例来源:origin: com.couchbase.client/core-io

@Override
public byte readByte() {
  return buf.readByte();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public byte readByte() {
  return buf.readByte();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public byte readByte() {
  return buf.readByte();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public byte readByte() {
  return buf.readByte();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public int read() throws IOException {
  if (buffer.isReadable()) {
    return buffer.readByte() & 0xff;
  }
  return -1;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public byte readByte() throws IOException {
  if (!buffer.isReadable()) {
    throw new EOFException();
  }
  return buffer.readByte();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public int read() throws IOException {
  if (!buffer.isReadable()) {
    return -1;
  }
  return buffer.readByte() & 0xff;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public byte readByte() {
  checkReadableBytes(1);
  return buffer.readByte();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public byte readByte() {
  checkReadableBytes(1);
  return buffer.readByte();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public int read() throws IOException {
  if (buffer.isReadable()) {
    return buffer.readByte() & 0xff;
  }
  return -1;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public int read() throws IOException {
  if (!buffer.isReadable()) {
    return -1;
  }
  return buffer.readByte() & 0xff;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public byte readByte() throws IOException {
  if (!buffer.isReadable()) {
    throw new EOFException();
  }
  return buffer.readByte();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List<Object> out) throws Exception {
  switch (state()) {
    case CHECK_PROTOCOL_VERSION: {
      if (byteBuf.readByte() != SocksProtocolVersion.SOCKS5.byteValue()) {
        out.add(SocksCommonUtils.UNKNOWN_SOCKS_RESPONSE);
        break;
      }
      checkpoint(State.READ_PREFERRED_AUTH_TYPE);
    }
    case READ_PREFERRED_AUTH_TYPE: {
      SocksAuthScheme authScheme = SocksAuthScheme.valueOf(byteBuf.readByte());
      out.add(new SocksInitResponse(authScheme));
      break;
    }
    default: {
      throw new Error();
    }
  }
  ctx.pipeline().remove(this);
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> out)
    throws Exception {
  switch (state()) {
    case CHECK_PROTOCOL_VERSION: {
      if (byteBuf.readByte() != SocksSubnegotiationVersion.AUTH_PASSWORD.byteValue()) {
        out.add(SocksCommonUtils.UNKNOWN_SOCKS_RESPONSE);
        break;
      }
      checkpoint(State.READ_AUTH_RESPONSE);
    }
    case READ_AUTH_RESPONSE: {
      SocksAuthStatus authStatus = SocksAuthStatus.valueOf(byteBuf.readByte());
      out.add(new SocksAuthResponse(authStatus));
      break;
    }
    default: {
      throw new Error();
    }
  }
  channelHandlerContext.pipeline().remove(this);
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
protected BinaryMemcacheResponse decodeHeader(ByteBuf in) {
  BinaryMemcacheResponse header = new DefaultBinaryMemcacheResponse();
  header.setMagic(in.readByte());
  header.setOpcode(in.readByte());
  if (header.getMagic() == FRAMING_MAGIC) {
    header.setFramingExtrasLength(in.readByte());
    header.setKeyLength(in.readByte());
  } else {
    header.setKeyLength(in.readShort());
  }
  header.setExtrasLength(in.readByte());
  header.setDataType(in.readByte());
  header.setStatus(in.readShort());
  header.setTotalBodyLength(in.readInt());
  header.setOpaque(in.readInt());
  header.setCAS(in.readLong());
  return header;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected BinaryMemcacheResponse decodeHeader(ByteBuf in) {
  BinaryMemcacheResponse header = new DefaultBinaryMemcacheResponse();
  header.setMagic(in.readByte());
  header.setOpcode(in.readByte());
  if (header.getMagic() == FRAMING_MAGIC) {
    header.setFramingExtrasLength(in.readByte());
    header.setKeyLength(in.readByte());
  } else {
    header.setKeyLength(in.readShort());
  }
  header.setExtrasLength(in.readByte());
  header.setDataType(in.readByte());
  header.setStatus(in.readShort());
  header.setTotalBodyLength(in.readInt());
  header.setOpaque(in.readInt());
  header.setCAS(in.readLong());
  return header;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
protected BinaryMemcacheRequest decodeHeader(ByteBuf in) {
  BinaryMemcacheRequest header = new DefaultBinaryMemcacheRequest();
  header.setMagic(in.readByte());
  header.setOpcode(in.readByte());
  header.setKeyLength(in.readShort());
  header.setExtrasLength(in.readByte());
  header.setDataType(in.readByte());
  header.setReserved(in.readShort());
  header.setTotalBodyLength(in.readInt());
  header.setOpaque(in.readInt());
  header.setCAS(in.readLong());
  return header;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected BinaryMemcacheRequest decodeHeader(ByteBuf in) {
  BinaryMemcacheRequest header = new DefaultBinaryMemcacheRequest();
  header.setMagic(in.readByte());
  header.setOpcode(in.readByte());
  header.setKeyLength(in.readShort());
  header.setExtrasLength(in.readByte());
  header.setDataType(in.readByte());
  header.setReserved(in.readShort());
  header.setTotalBodyLength(in.readInt());
  header.setOpaque(in.readInt());
  header.setCAS(in.readLong());
  return header;
}

代码示例来源:origin: com.couchbase.client/core-io

/**
 * Reads the next character into {@link #currentChar}.
 *
 * @param level the current level of nesting.
 * @throws EOFException if more input is needed.
 */
private void readNextChar(final JsonLevel level) throws EOFException {
  int readerIndex = content.readerIndex();
  int lastWsIndex = content.forEachByte(wsProcessor);
  if (lastWsIndex == -1 && level != null) {
    throw NEED_MORE_DATA;
  }
  if (lastWsIndex > readerIndex) {
    this.content.skipBytes(lastWsIndex - readerIndex);
    this.content.discardReadBytes();
  }
  this.currentChar = this.content.readByte();
}

代码示例来源:origin: couchbase/couchbase-jvm-core

/**
 * Reads the next character into {@link #currentChar}.
 *
 * @param level the current level of nesting.
 * @throws EOFException if more input is needed.
 */
private void readNextChar(final JsonLevel level) throws EOFException {
  int readerIndex = content.readerIndex();
  int lastWsIndex = content.forEachByte(wsProcessor);
  if (lastWsIndex == -1 && level != null) {
    throw NEED_MORE_DATA;
  }
  if (lastWsIndex > readerIndex) {
    this.content.skipBytes(lastWsIndex - readerIndex);
    this.content.discardReadBytes();
  }
  this.currentChar = this.content.readByte();
}

相关文章