JDK-5023614 : UUID needs methods to get most/leastSigBits and write to DataOutput
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-03-30
  • Updated: 2020-11-26
Description
Name: rmT116609			Date: 03/30/2004


A DESCRIPTION OF THE REQUEST :
The new java.util.UUID class in 1.5 beta 1 has a few ways to construct a UUID from 128 bits of raw data, including:

public UUID(long mostSigBits, long leastSigBits);
public UUID(java.io.DataInput in) throws IOException;  // reads two longs

There is also a private constructor which takes an array of 16 bytes.  It would be nice if this were public.

Currently, there is no corresponding way to get the raw data from an existing instance.  UUID should have methods such as the following:

public long getMostSignificanttBits();
public long getLeastSignificantBits();
public byte[] getData();
public void write(java.io.DataOutput);


JUSTIFICATION :
We are using a custom protocol to communicate between and java server and a C++ client.  We would prefer to marshall and unmarshall UUIDs using their underlying 128 bit values rather than converting them to strings.  The new UUID class gives us a way to unmarshall an instance from 128 bits of raw data, but no easy way to marshall an instance.
(Incident Review ID: 245647) 
======================================================================

Comments
EVALUATION Get most/leastSigBits already added for fix of 4977727. ###@###.### 2004-03-30
30-03-2004