org.eclipse.californium.core.Utils.toHexString()方法的使用及代码示例

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

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

Utils.toHexString介绍

[英]Converts the specified byte array to a hexadecimal string.
[中]将指定的字节数组转换为十六进制字符串。

代码示例

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

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

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

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

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

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

代码示例来源: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

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

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

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

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

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

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

代码示例来源: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

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

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

/**
 * Gets the 0--8 byte token as string representation.
 *
 * @return the token as string
 */
public String getTokenString() {
  return Utils.toHexString(getToken());
}

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

public String toString() {
    return "Expected token: " + Utils.toHexString(token);
  }
});

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

@Override
  public String toString() {
    return String.format("Expected etag: %s", Utils.toHexString(etag));
  }
});

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

public String toString() {
    Object[] pair = (Object[]) storage.get(var);
    return "Expected MID: " + pair[0] + " and token " + Utils.toHexString((byte[]) pair[1]);
  }
});

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

/**
 * Checks for Token option.
 * 
 * @param response
 *            the response
 * @return true, if successful
 */
protected boolean hasToken(Response response) {
  boolean success = response.getToken() != null;
  if (!success) {
    System.out.println("FAIL: Response without Token");
  } else {
    System.out.printf("PASS: Token (%s)\n",
        Utils.toHexString(response.getToken()));
  }
  return success;
}

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

/**
 * Helper function that creates a BlockOption with the specified parameters
 * and serializes them to a byte array.
 */
private static byte[] toBytes(int szx, boolean m, int num) {
  byte[] bytes = new BlockOption(szx, m, num).getValue();
   System.out.println("(szx="+szx+", m="+m+", num="+num+") => "
       + Utils.toHexString(bytes));
  return bytes;
}

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

protected final void appendEtags(final OptionSet options) {
  if (options != null && options.getETagCount() > 0) {
    buffer.append(", ETags(");
    int i = 0;
    for (byte[] tag : options.getETags()) {
      buffer.append(Utils.toHexString(tag));
      if (++i < options.getETagCount()) {
        buffer.append(", ");
      }
    }
    buffer.append(")");
  }
}
protected final void appendRequestDetails(final Request request) {

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

public void check(Message message) {
  assertArrayEquals("Wrong token:", token, message.getToken());
  print("Correct token: " + Utils.toHexString(token));
}

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

@Override
public void check(Message message) {
  Object[] pair = (Object[]) storage.get(var);
  assertEquals("Wrong MID:", pair[0], message.getMID());
  assertArrayEquals("Wrong token:", (byte[]) pair[1], message.getToken());
  print("Correct MID: " + message.getMID() + " and token: " + Utils.toHexString(message.getToken()));
}

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

/**
 * Converts a BlockOption with the specified parameters to a byte array and
 * back and checks that the result is the same as the original.
 */
private static void testCombined(int szx, boolean m, int num) {
  BlockOption block = new BlockOption(szx, m, num);
  BlockOption copy = new BlockOption(block.getValue());
  assertEquals(block.getSzx(), copy.getSzx());
  assertEquals(block.isM(), copy.isM());
  assertEquals(block.getNum(), copy.getNum());
  System.out.println(Utils.toHexString(block.getValue()) +" == " 
    + "(szx="+block.getSzx()+", m="+block.isM()+", num="+block.getNum()+")");
}

相关文章

微信公众号

最新文章

更多