org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf.capacity()方法的使用及代码示例

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

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

ByteBuf.capacity介绍

暂无

代码示例

代码示例来源:origin: com.alibaba.blink/flink-runtime

private void decodeFrameHeader() {
  int messageLength = frameHeaderBuffer.readInt();
  checkState(messageLength >= 0, "The length field of current message must be non-negative");
  int magicNumber = frameHeaderBuffer.readInt();
  checkState(magicNumber == MAGIC_NUMBER, "Network stream corrupted: received incorrect magic number.");
  msgId = frameHeaderBuffer.readByte();
  if (msgId != NettyMessage.BufferResponse.ID) {
    remainingMessageHeaderToCopy = messageLength - FRAME_HEADER_LENGTH;
  } else {
    remainingMessageHeaderToCopy = NettyMessage.BufferResponse.MESSAGE_HEADER_LENGTH;
  }
  if (messageHeaderBuffer.capacity() < remainingMessageHeaderToCopy) {
    messageHeaderBuffer.capacity(remainingMessageHeaderToCopy);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkSrcIndex(index, length, srcIndex, src.capacity());
  if (src.nioBufferCount() > 0) {
    for (ByteBuffer bb: src.nioBuffers(srcIndex, length)) {
      int bbLen = bb.remaining();
      setBytes(index, bb);
      index += bbLen;
    }
  } else {
    src.getBytes(srcIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkSrcIndex(index, length, srcIndex, src.capacity());
  if (src.nioBufferCount() > 0) {
    for (ByteBuffer bb: src.nioBuffers(srcIndex, length)) {
      int bbLen = bb.remaining();
      setBytes(index, bb);
      index += bbLen;
    }
  } else {
    src.getBytes(srcIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkSrcIndex(index, length, srcIndex, src.capacity());
  if (src.nioBufferCount() > 0) {
    for (ByteBuffer bb: src.nioBuffers(srcIndex, length)) {
      int bbLen = bb.remaining();
      setBytes(index, bb);
      index += bbLen;
    }
  } else {
    src.getBytes(srcIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkDstIndex(index, length, dstIndex, dst.capacity());
  if (dst.hasArray()) {
    getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
  } else if (dst.nioBufferCount() > 0) {
    for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
      int bbLen = bb.remaining();
      getBytes(index, bb);
      index += bbLen;
    }
  } else {
    dst.setBytes(dstIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkDstIndex(index, length, dstIndex, dst.capacity());
  if (dst.hasArray()) {
    getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
  } else if (dst.nioBufferCount() > 0) {
    for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
      int bbLen = bb.remaining();
      getBytes(index, bb);
      index += bbLen;
    }
  } else {
    dst.setBytes(dstIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  // from UnpooledDirectByteBuf:
  checkDstIndex(index, length, dstIndex, dst.capacity());
  if (dst.hasArray()) {
    getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
  } else if (dst.nioBufferCount() > 0) {
    for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
      int bbLen = bb.remaining();
      getBytes(index, bb);
      index += bbLen;
    }
  } else {
    dst.setBytes(dstIndex, this, index, length);
  }
  return this;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

.set(HttpHeaders.Names.HOST, targetAddress)
.set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE)
.add(HttpHeaders.Names.CONTENT_LENGTH, jsonPayload.capacity())
.add(HttpHeaders.Names.CONTENT_TYPE, RestConstants.REST_CONTENT_TYPE);

代码示例来源:origin: com.alibaba.blink/flink-runtime

.set(HttpHeaders.Names.HOST, targetAddress)
.set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE)
.add(HttpHeaders.Names.CONTENT_LENGTH, jsonPayload.capacity())
.add(HttpHeaders.Names.CONTENT_TYPE, RestConstants.REST_CONTENT_TYPE);

代码示例来源:origin: org.apache.flink/flink-runtime

.set(HttpHeaders.Names.HOST, targetAddress)
.set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE)
.add(HttpHeaders.Names.CONTENT_LENGTH, jsonPayload.capacity())
.add(HttpHeaders.Names.CONTENT_TYPE, RestConstants.REST_CONTENT_TYPE);

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

if (msgContent.capacity() == 0) {
  try {
    request = MAPPER.readValue("{}", untypedResponseMessageHeaders.getRequestClass());

代码示例来源:origin: com.alibaba.blink/flink-runtime

if (msgContent.capacity() == 0) {
  try {
    request = MAPPER.readValue("{}", untypedResponseMessageHeaders.getRequestClass());

代码示例来源:origin: org.apache.flink/flink-runtime

if (msgContent.capacity() == 0) {
  try {
    request = MAPPER.readValue("{}", untypedResponseMessageHeaders.getRequestClass());

相关文章