zj
2024-06-03 3603ecb207f7e712c635f19531e05fac4d19e53f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package project.data.websocket.service.huobi.utils;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
 
public class DataUtils {
 
    public static String getDataKey(JSONObject jsonObject) {
        String key = "data";
        Object dataObj = jsonObject.get(key);
        if (dataObj == null) {
            key = "tick";
            dataObj = jsonObject.get("tick");
        }
 
        if (dataObj == null) {
            return null;
        }
        return key;
    }
 
    public static boolean isJSONArray(Object object) {
        if (object instanceof JSONArray) {
            return true;
        }
        return false;
    }
 
    public static boolean isJSONObject(Object object) {
        if (object instanceof JSONObject) {
            return true;
        }
        return false;
    }
 
    public static void timeWait(Long millis) {
        try {
            System.out.println("time wait " + millis + " ms");
            Thread.sleep(millis);
        } catch (InterruptedException e) {
        }
    }
 
}