forked from APIJSON/APIJSON-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseRediSQLReply.java
More file actions
42 lines (32 loc) · 1.02 KB
/
ParseRediSQLReply.java
File metadata and controls
42 lines (32 loc) · 1.02 KB
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
package apijson.demo.redis;
import java.util.List;
public class ParseRediSQLReply {
public static boolean done_reply(List<Object> reply) {
if (reply.size() != 2) { return false; }
if ((reply.get(0) instanceof byte[]) && (new String((byte[])reply.get(0)).equals("DONE"))) {
return (reply.get(1) instanceof Long);
}
return false;
}
public static Long how_many_done(List<Object> reply) {
if (reply == null || reply.size() == 0 ||done_reply(reply) == false) {
return 0L;
}
return (Long)reply.get(1);
}
public static boolean is_integer(Object o) {
return (o instanceof Long);
}
public static Long get_integer(Object o) {
return (Long) o;
}
public static boolean is_string(Object o) {
return (o instanceof byte[]);
}
public static String get_string(Object o) {
return new String((byte[])o);
}
public static boolean is_list(Object o) {
return (o instanceof List);
}
}