From 0d75b97f3dc35013f1b6dca1b639e16275bfc95d Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期一, 14 二月 2022 15:48:53 +0800
Subject: [PATCH] 功能完善
---
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/HexStrConvertUtil.java | 94 ++++++++++++++++++++++++----------------------
1 files changed, 49 insertions(+), 45 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/HexStrConvertUtil.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/HexStrConvertUtil.java
index 63434b5..e7e51f9 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/HexStrConvertUtil.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/HexStrConvertUtil.java
@@ -1,5 +1,7 @@
package com.sandu.ximon.admin.utils;
+import java.util.ArrayList;
+
/**
* 16
*/
@@ -71,25 +73,25 @@
* @return: int
* @description: 鍗佸叚杩涘埗杞崄杩涘埗
*/
- public static int HexToInt(String content){
- int number=0;
- String [] HighLetter = {"A","B","C","D","E","F"};
- Map<String,Integer> map = new HashMap<>();
- for(int i = 0;i <= 9;i++){
- map.put(i+"",i);
- }
- for(int j= 10;j<HighLetter.length+10;j++){
- map.put(HighLetter[j-10],j);
- }
- String[]str = new String[content.length()];
- for(int i = 0; i < str.length; i++){
- str[i] = content.substring(i,i+1);
- }
- for(int i = 0; i < str.length; i++){
- number += map.get(str[i])*Math.pow(16,str.length-1-i);
- }
- return number;
- }
+// public static int HexToInt(String content){
+// int number=0;
+// String [] HighLetter = {"A","B","C","D","E","F"};
+// Map<String,Integer> map = new HashMap<>();
+// for(int i = 0;i <= 9;i++){
+// map.put(i+"",i);
+// }
+// for(int j= 10;j<HighLetter.length+10;j++){
+// map.put(HighLetter[j-10],j);
+// }
+// String[]str = new String[content.length()];
+// for(int i = 0; i < str.length; i++){
+// str[i] = content.substring(i,i+1);
+// }
+// for(int i = 0; i < str.length; i++){
+// number += map.get(str[i])*Math.pow(16,str.length-1-i);
+// }
+// return number;
+// }
/**
@@ -116,8 +118,9 @@
String sTemp;
for (int i = 0; i < bArray.length; i++) {
sTemp = Integer.toHexString(0xFF & bArray[i]);
- if (sTemp.length() < 2)
+ if (sTemp.length() < 2) {
sb.append(0);
+ }
sb.append(sTemp.toLowerCase());
}
return sb.toString();
@@ -127,8 +130,9 @@
StringBuffer sb = new StringBuffer();
String sTemp;
sTemp = Integer.toHexString(0xFF & b);
- if (sTemp.length() < 2)
+ if (sTemp.length() < 2) {
sb.append(0);
+ }
sb.append(sTemp.toLowerCase());
return sb.toString();
}
@@ -328,30 +332,30 @@
}
- public static byte[] readInputStream(InputStream inputStream) {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
- if (inputStream != null) {
- try {
- byte[] buffer = new byte[91];
- int counts;
- while ((counts = inputStream.read(buffer, 0, buffer.length)) > 0) {
- byteArrayOutputStream.write(buffer, 0, counts);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }/* finally {
- if (byteArrayOutputStream != null) {
- try {
- byteArrayOutputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }*/
- }
- return byteArrayOutputStream.toByteArray();
- }
+// public static byte[] readInputStream(InputStream inputStream) {
+// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+//
+// if (inputStream != null) {
+// try {
+// byte[] buffer = new byte[91];
+// int counts;
+// while ((counts = inputStream.read(buffer, 0, buffer.length)) > 0) {
+// byteArrayOutputStream.write(buffer, 0, counts);
+// }
+// } catch (IOException e) {
+// e.printStackTrace();
+// }/* finally {
+// if (byteArrayOutputStream != null) {
+// try {
+// byteArrayOutputStream.close();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+// }*/
+// }
+// return byteArrayOutputStream.toByteArray();
+// }
// br = new BufferedReader(new InputStreamReader(inputStream));
// byteArrayOutputStream = new ByteArrayOutputStream();
--
Gitblit v1.9.3