KLALB完全大重写,代码规范了,可以当作网络库使用

This commit is contained in:
Administrator
2023-06-23 08:34:15 +08:00
parent 0499ecb34d
commit f743b23e53
154 changed files with 2985 additions and 15058 deletions
@@ -0,0 +1,32 @@
package org.kne.cloud.network.klalb;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Inet6Address;
import java.net.UnknownHostException;
import java.util.UUID;
public class KLALBUtils {
public static Inet6Address uuidToIP(UUID uuid) {
ByteArrayOutputStream bos=new ByteArrayOutputStream(8);
DataOutputStream dos=new DataOutputStream(bos);
try {
dos.writeLong(uuid.getMostSignificantBits());
dos.writeLong(uuid.getLeastSignificantBits());
dos.close();} catch (IOException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
try {
return (Inet6Address) Inet6Address.getByAddress(bos.toByteArray());
} catch (UnknownHostException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
return null;
}
public static void main(String[] args) {
System.out.println(uuidToIP(new UUID(-1,-1)));
}
}