imToken v2.14.1版本的 MD5 值为:83050b2c91219b46832c8336279e7878
以下内容为反编译后的 Utils.java 源代码,内容仅作参考
package com.adobe.internal.xmp.impl;
import com.adobe.internal.xmp.XMPConst;
public class Utils implements XMPConst {
public static final int UUID_LENGTH = 36;
public static final int UUID_SEGMENT_COUNT = 4;
private static boolean[] xmlNameChars;
private static boolean[] xmlNameStartChars;
public static boolean isControlChar(char c2) {
return ((c2 > 31 && c2 != 127) || c2 == '\t' || c2 == '\n' || c2 == '\r') ? false : true;
}
static {
initCharTables();
}
private Utils() {
}
public static String normalizeLangValue(String str) {
if (XMPConst.X_DEFAULT.equals(str)) {
return str;
}
StringBuffer stringBuffer = new StringBuffer();
int i2 = 1;
for (int i3 = 0; i3 < str.length(); i3++) {
char charAt = str.charAt(i3);
if (charAt != ' ') {
if (charAt == '-' || charAt == '_') {
stringBuffer.append('-');
i2++;
} else if (i2 != 2) {
stringBuffer.append(Character.toLowerCase(str.charAt(i3)));
} else {
stringBuffer.append(Character.toUpperCase(str.charAt(i3)));
}
}
}
return stringBuffer.toString();
}
public static String[] splitNameAndValue(String str) {
int indexOf = str.indexOf(61);
String substring = str.substring(str.charAt(1) == '?' ? 2 : 1, indexOf);
int i2 = indexOf + 1;
char charAt = str.charAt(i2);
int i3 = i2 + 1;
int length = str.length() - 2;
StringBuffer stringBuffer = new StringBuffer(length - indexOf);
while (i3 < length) {
stringBuffer.append(str.charAt(i3));
i3++;
if (str.charAt(i3) == charAt) {
i3++;
}
}
return new String[]{substring, stringBuffer.toString()};
}
public static boolean isInternalProperty(String str, String str2) {
if ("http://purl.org/dc/elements/1.1/".equals(str)) {
if (!"dc:format".equals(str2) && !"dc:language".equals(str2)) {
return false;
}
} else if ("http://ns.adobe.com/xap/1.0/".equals(str)) {
if (!"xmp:BaseURL".equals(str2) && !"xmp:CreatorTool".equals(str2) && !"xmp:Format".equals(str2) && !"xmp:Locale".equals(str2) && !"xmp:MetadataDate".equals(str2) && !"xmp:ModifyDate".equals(str2)) {
return false;
}
} else if (XMPConst.NS_PDF.equals(str)) {
if (!"pdf:BaseURL".equals(str2) && !"pdf:Creator".equals(str2) && !"pdf:ModDate".equals(str2) && !"pdf:PDFVersion".equals(str2) && !"pdf:Producer".equals(str2)) {
return false;
}
} else if ("http://ns.adobe.com/tiff/1.0/".equals(str)) {
if ("tiff:ImageDescription".equals(str2) || "tiff:Artist".equals(str2) || "tiff:Copyright".equals(str2)) {
return false;
}
} else if ("http://ns.adobe.com/exif/1.0/".equals(str)) {
if ("exif:UserComment".equals(str2)) {
return false;
}
} else if (!"http://ns.adobe.com/exif/1.0/aux/".equals(str)) {
if (XMPConst.NS_PHOTOSHOP.equals(str)) {
if (!"photoshop:ICCProfile".equals(str2)) {
return false;
}
} else if (XMPConst.NS_CAMERARAW.equals(str)) {
if (!"crs:Version".equals(str2) && !"crs:RawFileName".equals(str2) && !"crs:ToneCurveName".equals(str2)) {
return false;
}
} else if (!XMPConst.NS_ADOBESTOCKPHOTO.equals(str) && !XMPConst.NS_XMP_MM.equals(str) && !XMPConst.TYPE_TEXT.equals(str) && !XMPConst.TYPE_PAGEDFILE.equals(str) && !XMPConst.TYPE_GRAPHICS.equals(str) && !XMPConst.TYPE_IMAGE.equals(str) && !XMPConst.TYPE_FONT.equals(str)) {
return false;
}
}
return true;
}
public static boolean checkUUIDFormat(String str) {
if (str == null) {
return false;
}
int i2 = 0;
int i3 = 0;
boolean z2 = true;
while (i2 < str.length()) {
if (str.charAt(i2) == '-') {
i3++;
z2 = z2 && (i2 == 8 || i2 == 13 || i2 == 18 || i2 == 23);
}
i2++;
}
return z2 && 4 == i3 && 36 == i2;
}
public static boolean isXMLName(String str) {
if (str.length() <= 0 || isNameStartChar(str.charAt(0))) {
for (int i2 = 1; i2 < str.length(); i2++) {
if (!isNameChar(str.charAt(i2))) {
return false;
}
}
return true;
}
return false;
}
public static boolean isXMLNameNS(String str) {
if (str.length() <= 0 || (isNameStartChar(str.charAt(0)) && str.charAt(0) != ':')) {
for (int i2 = 1; i2 < str.length(); i2++) {
if (!isNameChar(str.charAt(i2)) || str.charAt(i2) == ':') {
return false;
}
}
return true;
}
return false;
}
public static String escapeXML(String str, boolean z2, boolean z3) {
boolean z4;
for (int i2 = 0; i2 < str.length(); i2++) {
char charAt = str.charAt(i2);
if (charAt == '<' || charAt == '>' || charAt == '&' || ((z3 && (charAt == '\t' || charAt == '\n' || charAt == '\r')) || (z2 && charAt == '\"'))) {
z4 = true;
break;
}
}
z4 = false;
if (z4) {
StringBuffer stringBuffer = new StringBuffer((str.length() * 4) / 3);
for (int i3 = 0; i3 < str.length(); i3++) {
char charAt2 = str.charAt(i3);
if (z3 && (charAt2 == '\t' || charAt2 == '\n' || charAt2 == '\r')) {
stringBuffer.append("&#x");
stringBuffer.append(Integer.toHexString(charAt2).toUpperCase());
stringBuffer.append(';');
} else if (charAt2 == '\"') {
stringBuffer.append(z2 ? """ : "\"");
} else if (charAt2 == '&') {
stringBuffer.append("&");
} else if (charAt2 == '<') {
stringBuffer.append("<");
} else if (charAt2 == '>') {
stringBuffer.append(">");
} else {
stringBuffer.append(charAt2);
}
}
return stringBuffer.toString();
}
return str;
}
public static String removeControlChars(String str) {
StringBuffer stringBuffer = new StringBuffer(str);
for (int i2 = 0; i2 < stringBuffer.length(); i2++) {
if (isControlChar(stringBuffer.charAt(i2))) {
stringBuffer.setCharAt(i2, ' ');
}
}
return stringBuffer.toString();
}
private static boolean isNameStartChar(char c2) {
return (c2 <= 255 && xmlNameStartChars[c2]) || (c2 >= 256 && c2 <= 767) || ((c2 >= 880 && c2 <= 893) || ((c2 >= 895 && c2 <= 8191) || ((c2 >= 8204 && c2 <= 8205) || ((c2 >= 8304 && c2 <= 8591) || ((c2 >= 11264 && c2 <= 12271) || ((c2 >= 12289 && c2 <= 55295) || ((c2 >= 63744 && c2 <= 64975) || ((c2 >= 65008 && c2 <= 65533) || (c2 >= 0 && c2 <= 65535)))))))));
}
private static boolean isNameChar(char c2) {
return (c2 <= 255 && xmlNameChars[c2]) || isNameStartChar(c2) || (c2 >= 768 && c2 <= 879) || (c2 >= 8255 && c2 <= 8256);
}
private static void initCharTables() {
xmlNameChars = new boolean[256];
xmlNameStartChars = new boolean[256];
char c2 = 0;
while (true) {
boolean[] zArr = xmlNameChars;
if (c2 >= zArr.length) {
return;
}
boolean[] zArr2 = xmlNameStartChars;
boolean z2 = true;
zArr2[c2] = c2 == ':' || ('A' <= c2 && c2 <= 'Z') || c2 == '_' || (('a' <= c2 && c2 <= 'z') || ((192 <= c2 && c2 <= 214) || ((216 <= c2 && c2 <= 246) || (248 <= c2 && c2 <= 255))));
if (!zArr2[c2] && c2 != '-' && c2 != '.' && (('0' > c2 || c2 > '9') && c2 != 183)) {
z2 = false;
}
zArr[c2] = z2;
c2 = (char) (c2 + 1);
}
}
}