Java Code Examples for org.apache.rocketmq.common.UtilAll#ipToIPv4Str()

The following examples show how to use org.apache.rocketmq.common.UtilAll#ipToIPv4Str() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageClientIDSetter.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    if (ipBytes.length == 16) {
        return UtilAll.ipToIPv6Str(ipBytes);
    } else {
        return UtilAll.ipToIPv4Str(ipBytes);
    }
}
 
Example 2
Source File: MessageClientIDSetterTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetIPStrFromID() {
    byte[] ip = UtilAll.getIP();
    String ipStr = (4 == ip.length) ? UtilAll.ipToIPv4Str(ip) : UtilAll.ipToIPv6Str(ip);

    String uniqID = MessageClientIDSetter.createUniqID();
    String ipStrFromID = MessageClientIDSetter.getIPStrFromID(uniqID);

    assertThat(ipStr).isEqualTo(ipStrFromID);
}
 
Example 3
Source File: MessageClientIDSetter.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 4
Source File: MessageClientIDSetter.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 5
Source File: MessageClientIDSetter.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 6
Source File: MessageClientIDSetter.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 7
Source File: MessageClientIDSetter.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 8
Source File: MessageClientIDSetter.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}
 
Example 9
Source File: MessageClientIDSetter.java    From rocketmq_trans_message with Apache License 2.0 4 votes vote down vote up
public static String getIPStrFromID(String msgID) {
    byte[] ipBytes = getIPFromID(msgID);
    return UtilAll.ipToIPv4Str(ipBytes);
}