@Test public void testParseGUID() { for (GUID curr : GUID.KNOWN_GUIDS) { Assert.assertSame(curr, GUID .getConfigured(GUID.parseGUID(curr.toString()))); } final String toParse = "f8699e40-5b4d-11cf-a8fd-00805f5c442b"; GUID parsed = GUID.parseGUID(toParse); Assert.assertEquals(GUID.GUID_AUDIOSTREAM, parsed); parsed = GUID.parseGUID(toParse.toUpperCase(Locale.getDefault())); Assert.assertEquals(GUID.GUID_AUDIOSTREAM, parsed); }
public static GUID parseGUID(final String guid) throws GUIDFormatException { if (guid == null) { throw new GUIDFormatException("null"); } if (!GUID_PATTERN.matcher(guid).matches()) { throw new GUIDFormatException("Invalid guidData format."); } final int[] bytes = new int[GUID_LENGTH]; final int[] arrayIndices = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; int arrayPointer = 0; for (int i = 0; i < guid.length(); i++) { if (guid.charAt(i) == '-') { continue; } bytes[arrayIndices[arrayPointer++]] = Integer.parseInt(guid.substring(i, i + 2), 16); i++; } return new GUID(bytes); }
GUID { public static GUID parseGUID(final String guid) throws GUIDFormatException { if (guid == null) { throw new GUIDFormatException("null"); } if (!GUID_PATTERN.matcher(guid).matches()) { throw new GUIDFormatException("Invalid guidData format."); } final int[] bytes = new int[GUID_LENGTH]; final int[] arrayIndices = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; int arrayPointer = 0; for (int i = 0; i < guid.length(); i++) { if (guid.charAt(i) == '-') { continue; } bytes[arrayIndices[arrayPointer++]] = Integer.parseInt(guid.substring(i, i + 2), 16); i++; } return new GUID(bytes); } }
GUID { public static GUID parseGUID(final String guid) throws GUIDFormatException { if (guid == null) { throw new GUIDFormatException("null"); } if (!GUID_PATTERN.matcher(guid).matches()) { throw new GUIDFormatException("Invalid guidData format."); } final int[] bytes = new int[GUID_LENGTH]; final int[] arrayIndices = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; int arrayPointer = 0; for (int i = 0; i < guid.length(); i++) { if (guid.charAt(i) == '-') { continue; } bytes[arrayIndices[arrayPointer++]] = Integer.parseInt(guid.substring(i, i + 2), 16); i++; } return new GUID(bytes); } GUID(final byte[] value);  GUID(final int[] value);  GUID(final int[] value, final String desc);  GUID(final String guidString, final String desc); }
GUID { public static GUID parseGUID(final String guid) throws GUIDFormatException { if (guid == null) { throw new GUIDFormatException("null"); } if (!GUID_PATTERN.matcher(guid).matches()) { throw new GUIDFormatException("Invalid guidData format."); } final int[] bytes = new int[GUID_LENGTH]; final int[] arrayIndices = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; int arrayPointer = 0; for (int i = 0; i < guid.length(); i++) { if (guid.charAt(i) == '-') { continue; } bytes[arrayIndices[arrayPointer++]] = Integer.parseInt(guid.substring(i, i + 2), 16); i++; } return new GUID(bytes); } GUID(final byte[] value);  GUID(final int[] value);  GUID(final int[] value, final String desc);  GUID(final String guidString, final String desc); static boolean assertGUID(final int[] value); static GUID getConfigured(final GUID orig); static String getGuidDescription(final GUID guid); static GUID parseGUID(final String guid); @Override boolean equals(final Object obj); byte[] getBytes(); String getDescription(); int[] getGUID(); @Override int hashCode(); boolean isValid(); String prettyPrint(); @Override String toString(); }
GUID { public static GUID parseGUID(final String guid) throws GUIDFormatException { if (guid == null) { throw new GUIDFormatException("null"); } if (!GUID_PATTERN.matcher(guid).matches()) { throw new GUIDFormatException("Invalid guidData format."); } final int[] bytes = new int[GUID_LENGTH]; final int[] arrayIndices = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; int arrayPointer = 0; for (int i = 0; i < guid.length(); i++) { if (guid.charAt(i) == '-') { continue; } bytes[arrayIndices[arrayPointer++]] = Integer.parseInt(guid.substring(i, i + 2), 16); i++; } return new GUID(bytes); } GUID(final byte[] value);  GUID(final int[] value);  GUID(final int[] value, final String desc);  GUID(final String guidString, final String desc); static boolean assertGUID(final int[] value); static GUID getConfigured(final GUID orig); static String getGuidDescription(final GUID guid); static GUID parseGUID(final String guid); @Override boolean equals(final Object obj); byte[] getBytes(); String getDescription(); int[] getGUID(); @Override int hashCode(); boolean isValid(); String prettyPrint(); @Override String toString(); final static GUID GUID_AUDIO_ERROR_CONCEALEMENT_ABSENT; final static GUID GUID_AUDIO_ERROR_CONCEALEMENT_INTERLEAVED; final static GUID GUID_AUDIOSTREAM; final static GUID GUID_CONTENT_BRANDING; final static GUID GUID_CONTENT_ENCRYPTION; final static GUID GUID_CONTENTDESCRIPTION; final static GUID GUID_ENCODING; final static GUID GUID_EXTENDED_CONTENT_DESCRIPTION; final static GUID GUID_FILE; final static GUID GUID_HEADER; final static GUID GUID_HEADER_EXTENSION; final static GUID GUID_LANGUAGE_LIST; final static int GUID_LENGTH; final static GUID GUID_METADATA; final static GUID GUID_METADATA_LIBRARY; final static GUID GUID_STREAM; final static GUID GUID_STREAM_BITRATE_PROPERTIES; final static GUID GUID_UNSPECIFIED; final static GUID GUID_VIDEOSTREAM; final static GUID[] KNOWN_GUIDS; final static GUID SCRIPT_COMMAND_OBJECT; }