GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Grlfx/UUID: Generate UUIDs (or GUIDs) in Java

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
.settings
.settings
 
 
src
src
 
 
.classpath
.classpath
 
 
.gitignore
.gitignore
 
 
.project
.project
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

This is the original com.eaio.uuid, and you can now create pull requests for features that you've implemented yourself. :)

UUID

Generate UUIDs (or GUIDs) in Java

This is an implementation of the UUIDs and GUIDs specification in Java. UUIDs are 128 bit long identifiers that are guaranteed to be unique.

Download

Download UUID 3.4 (JAR)

Download UUID 3.4 (Source JAR)

Or get UUID through Maven:

    <dependencies>
        <dependency>
            <groupId>com.eaio.uuid</groupId>
            <artifactId>uuid</artifactId>
            <version>3.4</version>
        </dependency>
    </dependencies>
…
    <repositories>
        <repository>
            <id>eaio.com</id>
            <url>http://repo.eaio.com/maven2</url>
        </repository>
    </repositories>

Documentation

A UUID (or GUID) is a unique identifier that can be created whithout a central authority. UUIDs can be used if a sequence number is not good enough. This implementation is thread safe and very fast.

UUID generates version 1 UUIDs that contain the the MAC address of a network card. To obtain it, the following commands are invoked and their respective output parsed:

  • Microsoft Windows
    • ipconfig /all
  • Solaris
    • arp uname -n
  • Mac OS X, Linux, BSD, other Unices
    • ifconfig -a
  • HP-UX
    • /usr/sbin/lanscan
  • Solaris 11
    • dladm show-phys -m

UUID is licensed under the MIT License (OSI certified).

Example code

UUID is very easy to use.

import com.eaio.uuid.UUID;

public class UUIDTest {
 public static void main(String[] args) {
  UUID u = new UUID();
  System.out.println(u);
 }
}

You can assemble UUIDs yourself:

UUID u = new UUID(4242L, 4242L);

Of course, comparing and equality testing is fully implemented:

UUID u1 = new UUID(4242L, 0L);
UUID u2 = new UUID(5203L, 9412);
System.out.println(u1.equals(u2)); // prints out "false"
System.out.println(u1.compareTo(u2)); // prints out "-1"

As well as cloning:

UUID u1 = new UUID(4242L, 0L);
UUID u2 = (UUID) u1.clone();
UUID u3 = new UUID(u1); // or use the clone constructor

And parsing from Strings:

UUID u = new UUID("00000000-0000-002a-0000-00000000002a");

Keep in mind that this UUID implementation has public field, so cloning should be used for security purposes between in-VM system boundaries.

Other resources

  • UUID on johannburkard.de
  • Maven-generated Site
  • APIdoc

Analytics

About

Generate UUIDs (or GUIDs) in Java

Resources

Readme
License
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.