1 /*******************************************************************************
2 * Copyright (c) 2000, 2010 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.ole.win32;
16 public final class GUID {
20 public byte[] Data4 = new byte[8];
21 public static final int sizeof = COM.GUID_sizeof ();
23 static final String zeros = "00000000"; //$NON-NLS-1$
25 static String toHex (int v, int length) {
26 String t = Integer.toHexString (v).toUpperCase ();
27 int tlen = t.length ();
29 t = t.substring (tlen - length);
31 return zeros.substring (0, Math.max (0, length - tlen)) + t;
35 public String toString () {
36 return '{' + toHex (Data1, 8) + '-' +
37 toHex (Data2, 4) + '-' +
38 toHex (Data3, 4) + '-' +
39 toHex (Data4[0], 2) + toHex (Data4[1], 2) + '-' +
40 toHex (Data4[2], 2) + toHex (Data4[3], 2) + toHex (Data4[4], 2) + toHex (Data4[5], 2) + toHex (Data4[6], 2) + toHex (Data4[7], 2) + '}';