Initial commit
This commit is contained in:
22
sources/com/orhanobut/logger/AndroidLogAdapter.java
Normal file
22
sources/com/orhanobut/logger/AndroidLogAdapter.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AndroidLogAdapter implements LogAdapter {
|
||||
private final FormatStrategy a;
|
||||
private int b = 2;
|
||||
|
||||
public AndroidLogAdapter(FormatStrategy formatStrategy) {
|
||||
Utils.a(formatStrategy);
|
||||
this.a = formatStrategy;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.LogAdapter
|
||||
public boolean a(int i, String str) {
|
||||
return i >= this.b;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.LogAdapter
|
||||
public void a(int i, String str, String str2) {
|
||||
this.a.a(i, str, str2);
|
||||
}
|
||||
}
|
103
sources/com/orhanobut/logger/CsvFormatStrategy.java
Normal file
103
sources/com/orhanobut/logger/CsvFormatStrategy.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.HandlerThread;
|
||||
import android.text.TextUtils;
|
||||
import com.orhanobut.logger.DiskLogStrategy;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CsvFormatStrategy implements FormatStrategy {
|
||||
private static final String e = System.getProperty("line.separator");
|
||||
private final Date a;
|
||||
private final SimpleDateFormat b;
|
||||
private final LogStrategy c;
|
||||
private final String d;
|
||||
|
||||
public static final class Builder {
|
||||
Date a;
|
||||
SimpleDateFormat b;
|
||||
LogStrategy c;
|
||||
String d;
|
||||
private String e;
|
||||
|
||||
public Builder a(SimpleDateFormat simpleDateFormat) {
|
||||
this.b = simpleDateFormat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder b(String str) {
|
||||
this.d = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Builder() {
|
||||
this.d = "PRETTY_LOGGER";
|
||||
}
|
||||
|
||||
public Builder a(String str) {
|
||||
this.e = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CsvFormatStrategy a() {
|
||||
if (this.a == null) {
|
||||
this.a = new Date();
|
||||
}
|
||||
if (this.b == null) {
|
||||
this.b = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS", Locale.UK);
|
||||
}
|
||||
if (this.c == null) {
|
||||
if (TextUtils.isEmpty(this.e)) {
|
||||
this.e = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separatorChar + "logger";
|
||||
}
|
||||
HandlerThread handlerThread = new HandlerThread("AndroidFileLogger." + this.e);
|
||||
handlerThread.start();
|
||||
this.c = new DiskLogStrategy(new DiskLogStrategy.WriteHandler(handlerThread.getLooper(), this.e, 512000));
|
||||
}
|
||||
return new CsvFormatStrategy(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder a() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
private CsvFormatStrategy(Builder builder) {
|
||||
Utils.a(builder);
|
||||
this.a = builder.a;
|
||||
this.b = builder.b;
|
||||
this.c = builder.c;
|
||||
this.d = builder.d;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.FormatStrategy
|
||||
public void a(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
String a = a(str);
|
||||
this.a.setTime(System.currentTimeMillis());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.b.format(this.a));
|
||||
sb.append(",");
|
||||
sb.append(Utils.a(i));
|
||||
sb.append(",");
|
||||
sb.append(a);
|
||||
if (str2.contains(e)) {
|
||||
str2 = str2.replaceAll(e, " <br> ");
|
||||
}
|
||||
sb.append(",");
|
||||
sb.append(str2);
|
||||
sb.append(e);
|
||||
this.c.a(i, a, sb.toString());
|
||||
}
|
||||
|
||||
private String a(String str) {
|
||||
if (!Utils.a((CharSequence) str) && !Utils.a(this.d, str)) {
|
||||
return this.d + "-" + str;
|
||||
}
|
||||
return this.d;
|
||||
}
|
||||
}
|
21
sources/com/orhanobut/logger/DiskLogAdapter.java
Normal file
21
sources/com/orhanobut/logger/DiskLogAdapter.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiskLogAdapter implements LogAdapter {
|
||||
private final FormatStrategy a;
|
||||
|
||||
public DiskLogAdapter(FormatStrategy formatStrategy) {
|
||||
Utils.a(formatStrategy);
|
||||
this.a = formatStrategy;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.LogAdapter
|
||||
public void a(int i, String str, String str2) {
|
||||
this.a.a(i, str, str2);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.LogAdapter
|
||||
public boolean a(int i, String str) {
|
||||
return true;
|
||||
}
|
||||
}
|
95
sources/com/orhanobut/logger/DiskLogStrategy.java
Normal file
95
sources/com/orhanobut/logger/DiskLogStrategy.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiskLogStrategy implements LogStrategy {
|
||||
private final Handler a;
|
||||
|
||||
public DiskLogStrategy(Handler handler) {
|
||||
Utils.a(handler);
|
||||
this.a = handler;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.LogStrategy
|
||||
public void a(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
Handler handler = this.a;
|
||||
handler.sendMessage(handler.obtainMessage(i, str2));
|
||||
}
|
||||
|
||||
static class WriteHandler extends Handler {
|
||||
private final String a;
|
||||
private final int b;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
WriteHandler(Looper looper, String str, int i) {
|
||||
super(looper);
|
||||
Utils.a(looper);
|
||||
Utils.a(str);
|
||||
this.a = str;
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
private void a(FileWriter fileWriter, String str) throws IOException {
|
||||
Utils.a(fileWriter);
|
||||
Utils.a(str);
|
||||
fileWriter.append((CharSequence) str);
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
FileWriter fileWriter;
|
||||
String str = (String) message.obj;
|
||||
try {
|
||||
fileWriter = new FileWriter(a(this.a, new SimpleDateFormat("yyyy-MM-dd").format(new Date())), true);
|
||||
try {
|
||||
a(fileWriter, str);
|
||||
fileWriter.flush();
|
||||
fileWriter.close();
|
||||
} catch (IOException unused) {
|
||||
if (fileWriter != null) {
|
||||
try {
|
||||
fileWriter.flush();
|
||||
fileWriter.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException unused3) {
|
||||
fileWriter = null;
|
||||
}
|
||||
}
|
||||
|
||||
private File a(String str, String str2) {
|
||||
File file;
|
||||
Utils.a(str);
|
||||
Utils.a(str2);
|
||||
File file2 = new File(str);
|
||||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
File file3 = null;
|
||||
File file4 = new File(file2, String.format("%s_%s.csv", str2, 0));
|
||||
int i = 0;
|
||||
while (true) {
|
||||
File file5 = file4;
|
||||
file = file3;
|
||||
file3 = file5;
|
||||
if (!file3.exists()) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
file4 = new File(file2, String.format("%s_%s.csv", str2, Integer.valueOf(i)));
|
||||
}
|
||||
return (file == null || file.length() >= ((long) this.b)) ? file3 : file;
|
||||
}
|
||||
}
|
||||
}
|
6
sources/com/orhanobut/logger/FormatStrategy.java
Normal file
6
sources/com/orhanobut/logger/FormatStrategy.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface FormatStrategy {
|
||||
void a(int i, String str, String str2);
|
||||
}
|
8
sources/com/orhanobut/logger/LogAdapter.java
Normal file
8
sources/com/orhanobut/logger/LogAdapter.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface LogAdapter {
|
||||
void a(int i, String str, String str2);
|
||||
|
||||
boolean a(int i, String str);
|
||||
}
|
6
sources/com/orhanobut/logger/LogStrategy.java
Normal file
6
sources/com/orhanobut/logger/LogStrategy.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface LogStrategy {
|
||||
void a(int i, String str, String str2);
|
||||
}
|
15
sources/com/orhanobut/logger/LogcatLogStrategy.java
Normal file
15
sources/com/orhanobut/logger/LogcatLogStrategy.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LogcatLogStrategy implements LogStrategy {
|
||||
@Override // com.orhanobut.logger.LogStrategy
|
||||
public void a(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
if (str == null) {
|
||||
str = "NO_TAG";
|
||||
}
|
||||
Log.println(i, str, str2);
|
||||
}
|
||||
}
|
41
sources/com/orhanobut/logger/Logger.java
Normal file
41
sources/com/orhanobut/logger/Logger.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Logger {
|
||||
private static Printer a = new LoggerPrinter();
|
||||
|
||||
private Logger() {
|
||||
}
|
||||
|
||||
public static void a(LogAdapter logAdapter) {
|
||||
Printer printer = a;
|
||||
Utils.a(logAdapter);
|
||||
printer.a(logAdapter);
|
||||
}
|
||||
|
||||
public static void b(String str, Object... objArr) {
|
||||
a.e(str, objArr);
|
||||
}
|
||||
|
||||
public static void c(String str, Object... objArr) {
|
||||
a.c(str, objArr);
|
||||
}
|
||||
|
||||
public static Printer a(String str) {
|
||||
Printer printer = a;
|
||||
printer.a(str);
|
||||
return printer;
|
||||
}
|
||||
|
||||
public static void a(Object obj) {
|
||||
a.d(obj);
|
||||
}
|
||||
|
||||
public static void a(String str, Object... objArr) {
|
||||
a.a(null, str, objArr);
|
||||
}
|
||||
|
||||
public static void a(Throwable th, String str, Object... objArr) {
|
||||
a.a(th, str, objArr);
|
||||
}
|
||||
}
|
98
sources/com/orhanobut/logger/LoggerPrinter.java
Normal file
98
sources/com/orhanobut/logger/LoggerPrinter.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class LoggerPrinter implements Printer {
|
||||
private final ThreadLocal<String> a = new ThreadLocal<>();
|
||||
private final List<LogAdapter> b = new ArrayList();
|
||||
|
||||
LoggerPrinter() {
|
||||
}
|
||||
|
||||
private String f(String str, Object... objArr) {
|
||||
return (objArr == null || objArr.length == 0) ? str : String.format(str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public Printer a(String str) {
|
||||
if (str != null) {
|
||||
this.a.set(str);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void b(String str, Object... objArr) {
|
||||
a(null, str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void c(String str, Object... objArr) {
|
||||
a(5, (Throwable) null, str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void d(String str, Object... objArr) {
|
||||
a(3, (Throwable) null, str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void e(String str, Object... objArr) {
|
||||
a(4, (Throwable) null, str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void a(Throwable th, String str, Object... objArr) {
|
||||
a(6, th, str, objArr);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void d(Object obj) {
|
||||
a(3, (Throwable) null, Utils.b(obj), new Object[0]);
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void a(String str, Object... objArr) {
|
||||
a(2, (Throwable) null, str, objArr);
|
||||
}
|
||||
|
||||
public synchronized void a(int i, String str, String str2, Throwable th) {
|
||||
if (th != null && str2 != null) {
|
||||
str2 = str2 + " : " + Utils.a(th);
|
||||
}
|
||||
if (th != null && str2 == null) {
|
||||
str2 = Utils.a(th);
|
||||
}
|
||||
if (Utils.a((CharSequence) str2)) {
|
||||
str2 = "Empty/NULL log message";
|
||||
}
|
||||
for (LogAdapter logAdapter : this.b) {
|
||||
if (logAdapter.a(i, str)) {
|
||||
logAdapter.a(i, str, str2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.Printer
|
||||
public void a(LogAdapter logAdapter) {
|
||||
List<LogAdapter> list = this.b;
|
||||
Utils.a(logAdapter);
|
||||
list.add(logAdapter);
|
||||
}
|
||||
|
||||
private synchronized void a(int i, Throwable th, String str, Object... objArr) {
|
||||
Utils.a(str);
|
||||
a(i, a(), f(str, objArr), th);
|
||||
}
|
||||
|
||||
private String a() {
|
||||
String str = this.a.get();
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
this.a.remove();
|
||||
return str;
|
||||
}
|
||||
}
|
163
sources/com/orhanobut/logger/PrettyFormatStrategy.java
Normal file
163
sources/com/orhanobut/logger/PrettyFormatStrategy.java
Normal file
@@ -0,0 +1,163 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PrettyFormatStrategy implements FormatStrategy {
|
||||
private final int a;
|
||||
private final int b;
|
||||
private final boolean c;
|
||||
private final LogStrategy d;
|
||||
private final String e;
|
||||
|
||||
public static class Builder {
|
||||
int a;
|
||||
int b;
|
||||
boolean c;
|
||||
LogStrategy d;
|
||||
String e;
|
||||
|
||||
public Builder a(int i) {
|
||||
this.a = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder b(int i) {
|
||||
this.b = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Builder() {
|
||||
this.a = 2;
|
||||
this.b = 0;
|
||||
this.c = true;
|
||||
this.e = "PRETTY_LOGGER";
|
||||
}
|
||||
|
||||
public Builder a(boolean z) {
|
||||
this.c = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(LogStrategy logStrategy) {
|
||||
this.d = logStrategy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(String str) {
|
||||
this.e = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrettyFormatStrategy a() {
|
||||
if (this.d == null) {
|
||||
this.d = new LogcatLogStrategy();
|
||||
}
|
||||
return new PrettyFormatStrategy(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder a() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
private void b(int i, String str) {
|
||||
b(i, str, "├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄");
|
||||
}
|
||||
|
||||
private void c(int i, String str) {
|
||||
b(i, str, "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
|
||||
}
|
||||
|
||||
private PrettyFormatStrategy(Builder builder) {
|
||||
Utils.a(builder);
|
||||
this.a = builder.a;
|
||||
this.b = builder.b;
|
||||
this.c = builder.c;
|
||||
this.d = builder.d;
|
||||
this.e = builder.e;
|
||||
}
|
||||
|
||||
private void b(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
this.d.a(i, str, str2);
|
||||
}
|
||||
|
||||
private void c(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
for (String str3 : str2.split(System.getProperty("line.separator"))) {
|
||||
b(i, str, "│ " + str3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.orhanobut.logger.FormatStrategy
|
||||
public void a(int i, String str, String str2) {
|
||||
Utils.a(str2);
|
||||
String a = a(str);
|
||||
c(i, a);
|
||||
a(i, a, this.a);
|
||||
byte[] bytes = str2.getBytes();
|
||||
int length = bytes.length;
|
||||
if (length <= 4000) {
|
||||
if (this.a > 0) {
|
||||
b(i, a);
|
||||
}
|
||||
c(i, a, str2);
|
||||
a(i, a);
|
||||
return;
|
||||
}
|
||||
if (this.a > 0) {
|
||||
b(i, a);
|
||||
}
|
||||
for (int i2 = 0; i2 < length; i2 += 4000) {
|
||||
c(i, a, new String(bytes, i2, Math.min(length - i2, 4000)));
|
||||
}
|
||||
a(i, a);
|
||||
}
|
||||
|
||||
private String b(String str) {
|
||||
Utils.a(str);
|
||||
return str.substring(str.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
private void a(int i, String str, int i2) {
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
if (this.c) {
|
||||
b(i, str, "│ Thread: " + Thread.currentThread().getName());
|
||||
b(i, str);
|
||||
}
|
||||
int a = a(stackTrace) + this.b;
|
||||
if (i2 + a > stackTrace.length) {
|
||||
i2 = (stackTrace.length - a) - 1;
|
||||
}
|
||||
String str2 = "";
|
||||
while (i2 > 0) {
|
||||
int i3 = i2 + a;
|
||||
if (i3 < stackTrace.length) {
|
||||
str2 = str2 + " ";
|
||||
b(i, str, "│ " + str2 + b(stackTrace[i3].getClassName()) + "." + stackTrace[i3].getMethodName() + " (" + stackTrace[i3].getFileName() + ":" + stackTrace[i3].getLineNumber() + ")");
|
||||
}
|
||||
i2--;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(int i, String str) {
|
||||
b(i, str, "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
|
||||
}
|
||||
|
||||
private int a(StackTraceElement[] stackTraceElementArr) {
|
||||
Utils.a(stackTraceElementArr);
|
||||
for (int i = 5; i < stackTraceElementArr.length; i++) {
|
||||
String className = stackTraceElementArr[i].getClassName();
|
||||
if (!className.equals(LoggerPrinter.class.getName()) && !className.equals(Logger.class.getName())) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private String a(String str) {
|
||||
if (!Utils.a((CharSequence) str) && !Utils.a(this.e, str)) {
|
||||
return this.e + "-" + str;
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
}
|
22
sources/com/orhanobut/logger/Printer.java
Normal file
22
sources/com/orhanobut/logger/Printer.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.orhanobut.logger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Printer {
|
||||
Printer a(String str);
|
||||
|
||||
void a(LogAdapter logAdapter);
|
||||
|
||||
void a(String str, Object... objArr);
|
||||
|
||||
void a(Throwable th, String str, Object... objArr);
|
||||
|
||||
void b(String str, Object... objArr);
|
||||
|
||||
void c(String str, Object... objArr);
|
||||
|
||||
void d(Object obj);
|
||||
|
||||
void d(String str, Object... objArr);
|
||||
|
||||
void e(String str, Object... objArr);
|
||||
}
|
78
sources/com/orhanobut/logger/Utils.java
Normal file
78
sources/com/orhanobut/logger/Utils.java
Normal file
@@ -0,0 +1,78 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user