79 lines
2.7 KiB
Java
79 lines
2.7 KiB
Java
package com.orhanobut.logger;
|
|
|
|
import java.io.PrintWriter;
|
|
import java.io.StringWriter;
|
|
import java.net.UnknownHostException;
|
|
import java.util.Arrays;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class Utils {
|
|
static String a(int i) {
|
|
switch (i) {
|
|
case 2:
|
|
return "V";
|
|
case 3:
|
|
return "D";
|
|
case 4:
|
|
return "I";
|
|
case 5:
|
|
return "W";
|
|
case 6:
|
|
return "E";
|
|
case 7:
|
|
return "ASSERT";
|
|
default:
|
|
return "UNKNOWN";
|
|
}
|
|
}
|
|
|
|
static boolean a(CharSequence charSequence) {
|
|
return charSequence == null || charSequence.length() == 0;
|
|
}
|
|
|
|
public static String b(Object obj) {
|
|
return obj == null ? "null" : !obj.getClass().isArray() ? obj.toString() : obj instanceof boolean[] ? Arrays.toString((boolean[]) obj) : obj instanceof byte[] ? Arrays.toString((byte[]) obj) : obj instanceof char[] ? Arrays.toString((char[]) obj) : obj instanceof short[] ? Arrays.toString((short[]) obj) : obj instanceof int[] ? Arrays.toString((int[]) obj) : obj instanceof long[] ? Arrays.toString((long[]) obj) : obj instanceof float[] ? Arrays.toString((float[]) obj) : obj instanceof double[] ? Arrays.toString((double[]) obj) : obj instanceof Object[] ? Arrays.deepToString((Object[]) obj) : "Couldn't find a correct type for the object";
|
|
}
|
|
|
|
static boolean a(CharSequence charSequence, CharSequence charSequence2) {
|
|
int length;
|
|
if (charSequence == charSequence2) {
|
|
return true;
|
|
}
|
|
if (charSequence == null || charSequence2 == null || (length = charSequence.length()) != charSequence2.length()) {
|
|
return false;
|
|
}
|
|
if ((charSequence instanceof String) && (charSequence2 instanceof String)) {
|
|
return charSequence.equals(charSequence2);
|
|
}
|
|
for (int i = 0; i < length; i++) {
|
|
if (charSequence.charAt(i) != charSequence2.charAt(i)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static String a(Throwable th) {
|
|
if (th == null) {
|
|
return "";
|
|
}
|
|
for (Throwable th2 = th; th2 != null; th2 = th2.getCause()) {
|
|
if (th2 instanceof UnknownHostException) {
|
|
return "";
|
|
}
|
|
}
|
|
StringWriter stringWriter = new StringWriter();
|
|
PrintWriter printWriter = new PrintWriter(stringWriter);
|
|
th.printStackTrace(printWriter);
|
|
printWriter.flush();
|
|
return stringWriter.toString();
|
|
}
|
|
|
|
static <T> T a(T t) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new NullPointerException();
|
|
}
|
|
}
|