FileDocCategorySizeDatePackage
UUIDConverter.javaAPI Docmp4parser 1.0-RC-171413Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.util

UUIDConverter

public class UUIDConverter extends Object
UUID from/to byte array.

Fields Summary
Constructors Summary
Methods Summary
public static byte[]convert(java.util.UUID uuid)


        long msb = uuid.getMostSignificantBits();
        long lsb = uuid.getLeastSignificantBits();
        byte[] buffer = new byte[16];

        for (int i = 0; i < 8; i++) {
            buffer[i] = (byte) (msb >>> 8 * (7 - i));
        }
        for (int i = 8; i < 16; i++) {
            buffer[i] = (byte) (lsb >>> 8 * (7 - i));
        }

        return buffer;

    
public static java.util.UUIDconvert(byte[] uuidBytes)

        ByteBuffer b = ByteBuffer.wrap(uuidBytes);
        b.order(ByteOrder.BIG_ENDIAN);
        return new UUID(b.getLong(), b.getLong());