43 lines
1.5 KiB
Java
43 lines
1.5 KiB
Java
package com.thoughtworks.xstream.converters.basic;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ByteConverter extends AbstractSingleValueConverter {
|
|
static /* synthetic */ Class class$java$lang$Byte;
|
|
|
|
static /* synthetic */ Class class$(String str) {
|
|
try {
|
|
return Class.forName(str);
|
|
} catch (ClassNotFoundException e) {
|
|
throw new NoClassDefFoundError().initCause(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.ConverterMatcher
|
|
public boolean canConvert(Class cls) {
|
|
if (cls != Byte.TYPE) {
|
|
Class cls2 = class$java$lang$Byte;
|
|
if (cls2 == null) {
|
|
cls2 = class$("java.lang.Byte");
|
|
class$java$lang$Byte = cls2;
|
|
}
|
|
if (cls != cls2) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter
|
|
public Object fromString(String str) {
|
|
int intValue = Integer.decode(str).intValue();
|
|
if (intValue >= -128 && intValue <= 255) {
|
|
return new Byte((byte) intValue);
|
|
}
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
stringBuffer.append("For input string: \"");
|
|
stringBuffer.append(str);
|
|
stringBuffer.append('\"');
|
|
throw new NumberFormatException(stringBuffer.toString());
|
|
}
|
|
}
|