org.eclipse.californium.core.Utils类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(180)

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

Utils介绍

[英]Auxiliary helper methods for Californium.
[中]加利福尼亚的辅助辅助方法。

代码示例

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

/**
 * Formats a {@link CoapResponse} into a readable String representation. 
 * 
 * @param r the CoapResponse
 * @return the pretty print
 */
public static String prettyPrint(CoapResponse r) {
  return prettyPrint(r.advanced());
}

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

@Override
  public String toString() {
    return "KeyUri[" + uri + " for " + Utils.toHexString(address) + ":" + port + "]";
  }
}

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

return Utils.toHexText(payload, 256);

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

return Utils.toHexText(payload, 256);

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

@Override
  public String toString() {
    return "KeyMID[" + MID + " for " + Utils.toHexString(address) + ":" + port + "]";
  }
}

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

/**
 * Formats a {@link CoapResponse} into a readable String representation. 
 * 
 * @param r the CoapResponse
 * @return the pretty print
 */
public static String prettyPrint(CoapResponse r) {
  return prettyPrint(r.advanced());
}

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

@Override
  public String toString() {
    return "KeyToken[" + Utils.toHexString(token) + "]";
  }
}

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

System.out.println(Utils.prettyPrint(response));

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

protected boolean checkDifferentOption(byte[] expected, byte[] actual,
    String optionName) {
  boolean success = !Arrays.equals(expected, actual);
  if (!success) {
    System.out.println("FAIL: Option " + optionName + ": expected "
        + Utils.toHexString(expected) + " but was "
        + Utils.toHexString(actual));
  } else {
    System.out.println("PASS: Correct option " + optionName);
  }
  return success;
}

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

@Override
  public void onResponse(Response response) {
    System.out.println();
    System.out.println("**** TEST: " + testName + " ****");
    // checking the response
    if (response != null) {
      // print response info
      if (verbose) {
        System.out.println("Response received");
        System.out.println("Time elapsed (ms): "
            + response.getRTT());
        Utils.prettyPrint(response);
      }
      System.out.println("**** BEGIN CHECK ****");
      
      if (checkResponse(request, response)) {
        System.out.println("**** TEST PASSED ****");
        addSummaryEntry(testName + ": PASSED");
      } else {
        System.out.println("**** TEST FAILED ****");
        addSummaryEntry(testName + ": --FAILED--");
      }
      tickOffTest();
    }
  }
}

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

protected boolean checkOption(byte[] expectedOption,
    byte[] actualOption, String optionName) {
  boolean success = Arrays.equals(expectedOption, actualOption);
  if (!success) {
    System.out.println("FAIL: Option " + optionName + ": expected "
        + Utils.toHexString(expectedOption) + " but was "
        + Utils.toHexString(actualOption));
  } else {
    System.out.printf("PASS: Correct option %s\n", optionName);
  }
  return success;
}

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

public void test() {
  CoapResponse response = null;
  try {
    URI uri = new URI(SERVER_URI);
    CoapClient client = new CoapClient(uri);
    client.setEndpoint(new CoapEndpoint(dtlsConnector, NetworkConfig.getStandard()));
    response = client.get();
  } catch (URISyntaxException e) {
    System.err.println("Invalid URI: " + e.getMessage());
    System.exit(-1);
  }
  if (response != null) {
    System.out.println(response.getCode());
    System.out.println(response.getOptions());
    System.out.println(response.getResponseText());
    System.out.println("\nADVANCED\n");
    System.out.println(Utils.prettyPrint(response));
  } else {
    System.out.println("No response received.");
  }
}

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

@Override
public String toString() {
  return new StringBuilder("KeyToken[").append(Utils.toHexString(token)).append(", ")
      .append(Utils.toHexString(address)).append(":").append(port).append("]").toString();
}

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

System.out.println("Request for test " + this.testName
    + " sent");
Utils.prettyPrint(request);

代码示例来源:origin: org.eclipse.leshan/leshan-server-cluster

@Override
  public String toString() {
    return new StringBuilder("KeyId[").append(Utils.toHexString(id)).append("]").toString();
  }
}

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

System.out.println("Request for test " + this.testName
    + " sent");
Utils.prettyPrint(request);

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

@Override
  public String toString() {
    return new StringBuilder("KeyId[").append(Utils.toHexString(id)).append("]").toString();
  }
}

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

System.out.println("Request for test " + this.testName
    + " sent");
Utils.prettyPrint(request);
        System.out.println("Time elapsed (ms): "
            + response.getRTT());
        Utils.prettyPrint(response);

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

@Override
public String toString() {
  return new StringBuilder("KeyMID[").append(MID).append(", ").append(Utils.toHexString(address)).append(":")
      .append(port).append("]").toString();
}

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

System.out.println(Utils.prettyPrint(response));
System.out.println("Time elapsed (ms): " + response.getRTT());

相关文章