All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.swt.internal.ole.win32.GUID Maven / Gradle / Ivy

Go to download

SWT is an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.

The newest version!
/*******************************************************************************
 * Copyright (c) 2000, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.internal.ole.win32;

public final class GUID {
	public int Data1;
	public short Data2;
	public short Data3;
	public byte[] Data4 = new byte[8];
	public static final int sizeof = COM.GUID_sizeof ();

	static final String zeros = "00000000"; //$NON-NLS-1$

static String toHex (int v, int length) {
	String t = Integer.toHexString (v).toUpperCase ();
	int tlen = t.length ();
	if (tlen > length) {
		t = t.substring (tlen - length);
	}
	return zeros.substring (0, Math.max (0, length - tlen)) + t;
}

public String toString () {
	return '{' + toHex (Data1, 8) + '-' + 
    	toHex (Data2, 4) + '-' + 
    	toHex (Data3, 4) + '-' + 
    	toHex (Data4[0], 2) + toHex (Data4[1], 2) + '-' + 
    	toHex (Data4[2], 2) + toHex (Data4[3], 2) + toHex (Data4[4], 2) + toHex (Data4[5], 2) + toHex (Data4[6], 2) + toHex (Data4[7], 2) + '}';
}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy