- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
71 lines
2.1 KiB
Java
71 lines
2.1 KiB
Java
package com.amazonaws.util;
|
|
|
|
import com.amazonaws.logging.Log;
|
|
import com.amazonaws.logging.LogFactory;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.Closeable;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
|
|
/* loaded from: classes.dex */
|
|
public enum IOUtils {
|
|
;
|
|
|
|
private static final int BUFFER_SIZE = 4096;
|
|
private static final Log logger = LogFactory.getLog(IOUtils.class);
|
|
|
|
public static byte[] toByteArray(InputStream inputStream) throws IOException {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
try {
|
|
byte[] bArr = new byte[4096];
|
|
while (true) {
|
|
int read = inputStream.read(bArr);
|
|
if (read != -1) {
|
|
byteArrayOutputStream.write(bArr, 0, read);
|
|
} else {
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
byteArrayOutputStream.close();
|
|
return byteArray;
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
byteArrayOutputStream.close();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public static String toString(InputStream inputStream) throws IOException {
|
|
return new String(toByteArray(inputStream), StringUtils.UTF8);
|
|
}
|
|
|
|
public static void closeQuietly(Closeable closeable, Log log) {
|
|
if (closeable != null) {
|
|
try {
|
|
closeable.close();
|
|
} catch (IOException e) {
|
|
if (logger.isDebugEnabled()) {
|
|
logger.debug("Ignore failure in closing the Closeable", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void release(Closeable closeable, Log log) {
|
|
closeQuietly(closeable, log);
|
|
}
|
|
|
|
public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
|
|
byte[] bArr = new byte[4096];
|
|
long j = 0;
|
|
while (true) {
|
|
int read = inputStream.read(bArr);
|
|
if (read <= -1) {
|
|
return j;
|
|
}
|
|
outputStream.write(bArr, 0, read);
|
|
j += read;
|
|
}
|
|
}
|
|
}
|