public class GetDNSUtil
extends java.lang.Object
This class contains helper functions to extract specific data from dns response.
Constructor and Description |
---|
GetDNSUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToHexString(byte[] bytes)
This methods converts byte array to hex String
|
static java.util.ArrayList<java.lang.Object> |
getAsArrayList(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.String path)
This method is used to extract an ArrayList from the response by providing
the path.
|
static java.util.ArrayList<java.util.Map<java.lang.String,java.lang.Object>> |
getAsListOfMap(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.String path)
This method is used to extract an Map of ArrayList from the response by providing the
path.
|
static java.util.HashMap<java.lang.String,java.lang.Object> |
getAsMap(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.String path)
This method is used to extract an Map from the response by providing the
path.
|
static java.lang.String |
getDnssecStatus(java.util.HashMap<java.lang.String,java.lang.Object> info)
This method returns DNSSEC status text.
|
static java.lang.String |
getDnsStatus(java.util.HashMap<java.lang.String,java.lang.Object> info)
This method returns the getDns status text.
|
static java.lang.Object |
getObject(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.String path)
This method is used to extract an Object from the response by providing
the path.
Example: |
static java.lang.String |
printReadable(java.lang.Object info)
This method print readable parts of the response to standard output.
|
public static java.lang.String bytesToHexString(byte[] bytes)
bytes
- input byte arraypublic static java.util.ArrayList<java.lang.Object> getAsArrayList(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String path)
This method is used to extract an ArrayList from the response by providing
the path.
Example:
1. ArrayList<Object> answers = GetDNSUtil.getAsArrayList(info, "/replies_tree[0]/answer"); 2. ArrayList<Object> authority = GetDNSUtil.getAsArrayList(info, "/replies_tree[0]/authority");
map
- Response object.path
- Path to be searched in the map.public static java.util.ArrayList<java.util.Map<java.lang.String,java.lang.Object>> getAsListOfMap(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String path)
This method is used to extract an Map of ArrayList from the response by providing the
path.
Example:
1. ArrayList<Map<String,Object>> authority = GetDNSUtil.getAsListOfMap(info, "/replies_tree[0]/authority");
map
- Response object.path
- Path to be searched in the map.public static java.util.HashMap<java.lang.String,java.lang.Object> getAsMap(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String path)
This method is used to extract an Map from the response by providing the
path.
Example:
1. HashMap<String, Object> rdata = GetDNSUtil.getAsMap(info, "/replies_tree[0]/authority[0]/rdata");
map
- Response object.path
- Path to be searched in the map.public static java.lang.String getDnssecStatus(java.util.HashMap<java.lang.String,java.lang.Object> info)
info
- Response object.public static java.lang.String getDnsStatus(java.util.HashMap<java.lang.String,java.lang.Object> info)
info
- Response object.public static java.lang.Object getObject(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String path)
This method is used to extract an Object from the response by providing
the path.
Example:
1. Object data = GetDNSUtil.getObject(info, "/replies_tree[0]/authority[1]/rdata/rdata_raw").toString());
map
- Response object.path
- Path to be searched in the map.public static java.lang.String printReadable(java.lang.Object info)
info
- Response object.