Files
rr3-apk/decompiled/sources/com/amazonaws/util/IOUtils.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

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;
}
}
}