本文整理了Java中org.eclipse.californium.core.coap.OptionSet.setBlock2()
方法的一些代码示例,展示了OptionSet.setBlock2()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OptionSet.setBlock2()
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.OptionSet
类名称:OptionSet
方法名:setBlock2
[英]Sets the Block2 option based on its components. Returns the current OptionSet object for a fluent API.
[中]根据其组件设置Block2选项。返回fluent API的当前OptionSet对象。
代码示例来源:origin: eclipse/californium
public CB06(String serverURI) {
super(CB06.class.getSimpleName());
Request request = Request.newGet();
request.getOptions().setBlock2(EXPECTED_BLOCK_SIZE, false, 0);
// set the parameters and execute the request
executeRequest(request, serverURI, "/large");
}
代码示例来源:origin: eclipse/californium
public CB01(String serverURI) {
super(CB01.class.getSimpleName());
Request request = Request.newGet();
request.getOptions().setBlock2(BlockOption.size2Szx(64), false, 0);
// set the parameters and execute the request
executeRequest(request, serverURI, "/large");
}
代码示例来源:origin: eclipse/californium
/**
* Sends the specified request over the specified endpoint.
*
* @param request the request
* @param outEndpoint the endpoint
* @return the request
*/
protected Request send(Request request, Endpoint outEndpoint) {
if (blockwise!=0) {
request.getOptions().setBlock2(new BlockOption(BlockOption.size2Szx(this.blockwise), false, 0));
}
outEndpoint.sendRequest(request);
return request;
}
代码示例来源:origin: eclipse/californium
public void set(Message message) {
message.getOptions().setBlock2(BlockOption.size2Szx(size), m, num);
}
});
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Sends the specified request over the specified endpoint.
*
* @param request the request
* @param outEndpoint the endpoint
* @return the request
*/
protected Request send(Request request, Endpoint outEndpoint) {
// use the specified message type
request.setType(this.type);
if (blockwise!=0) {
request.getOptions().setBlock2(new BlockOption(BlockOption.size2Szx(this.blockwise), false, 0));
}
outEndpoint.sendRequest(request);
return request;
}
代码示例来源:origin: eclipse/californium
byte[] blockPayload = new byte[length];
boolean m = (to < response.getPayloadSize());
block.getOptions().setBlock2(szx, m, num);
block.getOptions().setBlock2(szx, false, num);
block.setLast(true);
status.setComplete(true);
代码示例来源:origin: org.eclipse.californium/californium-core
byte[] blockPayload = new byte[length];
boolean m = (to < response.getPayloadSize());
block.getOptions().setBlock2(szx, m, num);
block.getOptions().setBlock2(szx, false, num);
block.setLast(true);
status.setComplete(true);
代码示例来源:origin: eclipse/californium
/**
* Verifies that a request for a resource with a body exceeding the max buffer size is
* cancelled when the first response block is received.
*/
@Test
public void testReceiveResponseCancelsRequestForExcessiveResponseBody() {
NetworkConfig config = NetworkConfig.createStandardWithoutFile()
.setInt(Keys.MAX_MESSAGE_SIZE, 128)
.setInt(Keys.MAX_RESOURCE_BODY_SIZE, 200);
MessageObserver requestObserver = mock(MessageObserver.class);
BlockwiseLayer blockwiseLayer = new BlockwiseLayer(config);
Request req = Request.newGet();
req.setURI("coap://127.0.0.1/bigResource");
req.addMessageObserver(requestObserver);
Response response = Response.createResponse(req, ResponseCode.CONTENT);
response.getOptions().setSize2(256).setBlock2(BlockOption.size2Szx(64), true, 0);
Exchange exchange = new Exchange(null, Origin.LOCAL);
exchange.setRequest(req);
blockwiseLayer.receiveResponse(exchange, response);
verify(requestObserver).onCancel();
}
代码示例来源:origin: eclipse/californium
Request request = Request.newGet();
request.setURI(uri);
request.getOptions().setBlock2(szx, false, num);
代码示例来源:origin: eclipse/californium
block.getOptions().setBlock2(szx, m, num);
代码示例来源:origin: eclipse/californium
case OptionNumberRegistry.PROXY_SCHEME: setProxyScheme(option.getStringValue()); break;
case OptionNumberRegistry.BLOCK1: setBlock1(option.getValue()); break;
case OptionNumberRegistry.BLOCK2: setBlock2(option.getValue()); break;
case OptionNumberRegistry.SIZE1: setSize1(option.getIntegerValue()); break;
case OptionNumberRegistry.SIZE2: setSize2(option.getIntegerValue()); break;
代码示例来源:origin: org.eclipse.californium/californium-core
block.getOptions().setBlock2(szx, m, num);
代码示例来源:origin: org.eclipse.californium/californium-core
case OptionNumberRegistry.PROXY_SCHEME: setProxyScheme(option.getStringValue()); break;
case OptionNumberRegistry.BLOCK1: setBlock1(option.getValue()); break;
case OptionNumberRegistry.BLOCK2: setBlock2(option.getValue()); break;
case OptionNumberRegistry.SIZE1: setSize1(option.getIntegerValue()); break;
case OptionNumberRegistry.SIZE2: setSize2(option.getIntegerValue()); break;
代码示例来源:origin: eclipse/californium
request.getOptions().setBlock2(BlockOption.size2Szx(64), false, 0);
client.sendRequest(request);
代码示例来源:origin: eclipse/californium
request.getOptions().setBlock2(BlockOption.size2Szx(64), false, 0);
client.sendRequest(request);
内容来源于网络,如有侵权,请联系作者删除!