org.eclipse.californium.core.coap.OptionSet.getSize2()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(60)

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

OptionSet.getSize2介绍

[英]Returns the uint value of the Size2 option.
[中]返回Size2选项的uint值。

代码示例

代码示例来源:origin: eclipse/californium

protected final void appendSize2(final OptionSet options) {
  if (options != null && options.hasSize2()) {
    buffer.append(", size2(").append(options.getSize2()).append(")");
  }
}

代码示例来源:origin: eclipse/californium

private boolean responseExceedsMaxBodySize(final Response response) {
  return response.getOptions().hasSize2() && response.getOptions().getSize2() > maxResourceBodySize;
}

代码示例来源:origin: eclipse/californium

@Override
public void check(final Response response) {
  assertThat("Wrong size2", response.getOptions().getSize2(), is(expectedSize));
}

代码示例来源:origin: org.eclipse.californium/californium-core

options.add(new Option(OptionNumberRegistry.SIZE1, getSize1()));
if (hasSize2())
  options.add(new Option(OptionNumberRegistry.SIZE2, getSize2()));

代码示例来源:origin: eclipse/californium

options.add(new Option(OptionNumberRegistry.SIZE1, getSize1()));
if (hasSize2())
  options.add(new Option(OptionNumberRegistry.SIZE2, getSize2()));

代码示例来源:origin: eclipse/californium

private BlockwiseStatus findResponseBlockStatus(final Exchange exchange, final Response response) {
  BlockwiseStatus status = exchange.getResponseBlockStatus();
  if (status == null) {
    if (exchange.isOfLocalOrigin()) {
      // we are receiving a large body in response to a request originating locally
      // we need to be prepared to buffer up to MAX_RESOURCE_BODY_SIZE bytes
      int bufferSize = maxResourceBodySize;
      if (response.getOptions().hasBlock2() && response.getOptions().hasSize2()) {
        // use size indication for allocating buffer
        bufferSize = response.getOptions().getSize2();
      }
      status = new BlockwiseStatus(bufferSize, response.getOptions().getContentFormat());
    } else {
      // we are sending out a large body in response to a request from a peer
      // we do not need to buffer and assemble anything
      status = new BlockwiseStatus(0, response.getOptions().getContentFormat());
    }
    status.setCurrentSzx(computeSZX(preferredBlockSize));
    status.setFirst(response);
    exchange.setResponseBlockStatus(status);
    LOGGER.log(Level.FINER, "There is no blockwise status yet. Create and set new Block2 status: {0}", status);
  } else {
    LOGGER.log(Level.FINER, "Current Block2 status: {0}", status);
  }
  // sets a timeout to complete exchange
  prepareBlockCleanup(exchange);
  return status;
}

相关文章

微信公众号

最新文章

更多