39 lines
1.4 KiB
Java
39 lines
1.4 KiB
Java
package d0.y;
|
|
|
|
import d0.z.d.m;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
/* compiled from: IOStreams.kt */
|
|
public final class a {
|
|
public static final long copyTo(InputStream inputStream, OutputStream outputStream, int i) {
|
|
m.checkNotNullParameter(inputStream, "$this$copyTo");
|
|
m.checkNotNullParameter(outputStream, "out");
|
|
byte[] bArr = new byte[i];
|
|
int read = inputStream.read(bArr);
|
|
long j = 0;
|
|
while (read >= 0) {
|
|
outputStream.write(bArr, 0, read);
|
|
j += (long) read;
|
|
read = inputStream.read(bArr);
|
|
}
|
|
return j;
|
|
}
|
|
|
|
public static /* synthetic */ long copyTo$default(InputStream inputStream, OutputStream outputStream, int i, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
i = 8192;
|
|
}
|
|
return copyTo(inputStream, outputStream, i);
|
|
}
|
|
|
|
public static final byte[] readBytes(InputStream inputStream) {
|
|
m.checkNotNullParameter(inputStream, "$this$readBytes");
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(Math.max(8192, inputStream.available()));
|
|
copyTo$default(inputStream, byteArrayOutputStream, 0, 2, null);
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
m.checkNotNullExpressionValue(byteArray, "buffer.toByteArray()");
|
|
return byteArray;
|
|
}
|
|
}
|