本文整理了Java中org.eclipse.californium.core.coap.OptionSet.getLocationQueryString()
方法的一些代码示例,展示了OptionSet.getLocationQueryString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OptionSet.getLocationQueryString()
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.OptionSet
类名称:OptionSet
方法名:getLocationQueryString
[英]Returns the Location-Query options as &-separated list string.
[中]以&-分隔的列表字符串形式返回位置查询选项。
代码示例来源:origin: eclipse/californium
/**
* Returns the Location-Path and Location-Query options as relative URI string.
* @return the Location-* as string
*/
public String getLocationString() {
StringBuilder builder = new StringBuilder();
builder.append("/");
builder.append(getLocationPathString());
if (getLocationQueryCount()>0) {
builder.append("?");
builder.append(getLocationQueryString());
}
return builder.toString();
}
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Returns the Location-Path and Location-Query options as relative URI string.
* @return the Location-* as string
*/
public String getLocationString() {
StringBuilder builder = new StringBuilder();
builder.append("/");
builder.append(getLocationPathString());
if (getLocationQueryCount()>0) {
builder.append("?");
builder.append(getLocationQueryString());
}
return builder.toString();
}
代码示例来源:origin: eclipse/californium
/**
* Checks for Location-Query option.
*
* @param response
* the response
* @return true, if successful
*/
protected boolean hasLocationQuery(Response response) {
// boolean success =
// response.hasOption(OptionNumberRegistry.LOCATION_QUERY);
boolean success = response.getOptions().getLocationQueryCount() > 0;
if (!success) {
System.out.println("FAIL: Response without Location-Query");
} else {
System.out.printf("PASS: Location-Query (%s)\n", response
.getOptions().getLocationQueryString());
}
return success;
}
代码示例来源:origin: eclipse/californium
@Test public void testUTF8Encoding() {
Response response = new Response(ResponseCode.CONTENT);
response.setType(Type.NON);
response.setMID(expectedMid);
response.setToken(new byte[] {});
response.getOptions().addLocationPath("ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ").addLocationPath("γλώσσα")
.addLocationPath("пустынных").addLocationQuery("ვეპხის=யாமறிந்த").addLocationQuery("⠊⠀⠉⠁⠝=⠑⠁⠞⠀⠛⠇⠁⠎⠎");
response.setPayload("⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑");
RawData rawData = serializer.serializeResponse(response);
Response result = (Response) parser.parseMessage(rawData);
assertEquals("ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ/γλώσσα/пустынных", response.getOptions().getLocationPathString());
assertEquals("ვეპხის=யாமறிந்த&⠊⠀⠉⠁⠝=⠑⠁⠞⠀⠛⠇⠁⠎⠎", response.getOptions().getLocationQueryString());
assertEquals("⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑", result.getPayloadString());
assertEquals(response.getMID(), result.getMID());
}
}
内容来源于网络,如有侵权,请联系作者删除!