Java Convert via ByteBuffer toThriftBinary(UUID uuid)

Here you can find the source of toThriftBinary(UUID uuid)

Description

to Thrift Binary

License

Apache License

Declaration

public static byte[] toThriftBinary(UUID uuid) 

Method Source Code


//package com.java2s;
/*/*from www.  jav a 2s  .  c o m*/
Apache Licensed Code modified from:
        
 */

import java.nio.ByteBuffer;

import java.util.UUID;

public class Main {
    public static final int UUID_BYTES = 16;

    public static byte[] toThriftBinary(UUID uuid) {
        ByteBuffer bb = ByteBuffer.wrap(new byte[UUID_BYTES]);
        bb.putLong(uuid.getMostSignificantBits());
        bb.putLong(uuid.getLeastSignificantBits());
        return bb.array();
    }
}

Related

  1. toString(InputStream is)
  2. toString(Object o)
  3. toString(Reader r)
  4. toString(Reader reader)
  5. toText(@Nonnull byte[] bytes)
  6. toURI(String value)
  7. toUTF(byte[] bytes)
  8. toUTF8(String str)
  9. toUuid(byte[] bytes)