Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5023614

UUID needs methods to get most/leastSigBits and write to DataOutput

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • Fix Understood
    • x86
    • windows_xp

      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)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: