Made byte constructor public and changed the length assertion to an `IllegalArgumentException`, added a `getBytes` method that allows users to retrieve the raw bytes of the UUID, and created a new private constructor with an optimized construction for byte arrays that can set the version as desired and the variant to RFC 4122. Also changed the existing static factory methods to use the new constructor and removed the duplicate code from them where the variant and version is being set.
Report [5023614](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=5023614) asks for more than what I provided and with different names. However, I believe that there is no value in providing methods to deal with `DataInput` and `DataOutput` because they would only encapsulate single method calls that the caller can directly write as well (e.g. `output.write(uuid.getBytes())` vs `uuid.write(output)`). Hence, I consider this change to satisfy the feature request. ------------- Commit messages: - 5023614: UUID needs methods to get most/leastSigBits and write to DataOutput Changes: https://git.openjdk.java.net/jdk/pull/1465/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1465&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-5023614 Stats: 115 lines in 2 files changed: 91 ins; 14 del; 10 mod Patch: https://git.openjdk.java.net/jdk/pull/1465.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/1465/head:pull/1465 PR: https://git.openjdk.java.net/jdk/pull/1465