Code example for InetAddress

Methods: getAddress

    /** creates a type1 uuid but substitutes hash of the IP where the mac would go. */ 
    public static UUID makeType1UUIDFromHost(InetAddress addr)
        MessageDigest digest = FBUtilities.threadLocalMD5Digest();
        byte[] md5 = digest.digest();
        byte[] fauxMac = new byte[6];
        System.arraycopy(md5, 0, fauxMac, 0, Math.min(md5.length, fauxMac.length));
        return getUUID(ByteBuffer.wrap(UUIDGenerator.getInstance().generateTimeBasedUUID(new EthernetAddress(fauxMac)).toByteArray()));
    /** creates a type 1 uuid from raw bytes. */ 
    public static UUID getUUID(ByteBuffer raw)
        return new UUID(raw.getLong(raw.position()), raw.getLong(raw.position() + 8));
    /** decomposes a uuid into raw bytes. */ 
    public static byte[] decompose(UUID uuid)
Experience pair programming with AI  Get Codota for Java