Rabbit-R1/android (non root)/java/sources/okio/internal/RealBufferedSourceKt.java
2024-05-21 17:08:36 -04:00

490 lines
26 KiB
Java

package okio.internal;
import androidx.core.location.LocationRequestCompat;
import java.io.EOFException;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.CharsKt;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import okio.Okio;
import okio.Options;
import okio.PeekSource;
import okio.RealBufferedSource;
import okio.Sink;
import okio.Timeout;
import okio.Util;
/* compiled from: RealBufferedSource.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000j\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0005\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0012\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0010\n\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0080\b\u001a\r\u0010\u0003\u001a\u00020\u0004*\u00020\u0002H\u0080\b\u001a%\u0010\u0005\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00062\u0006\u0010\n\u001a\u00020\u0006H\u0080\b\u001a\u001d\u0010\u0005\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\u0006H\u0080\b\u001a\u001d\u0010\r\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u000e\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\u0006H\u0080\b\u001a\r\u0010\u000f\u001a\u00020\u0010*\u00020\u0002H\u0080\b\u001a-\u0010\u0011\u001a\u00020\u0004*\u00020\u00022\u0006\u0010\u0012\u001a\u00020\u00062\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0014H\u0080\b\u001a%\u0010\u0016\u001a\u00020\u0014*\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0012\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0014H\u0080\b\u001a\u001d\u0010\u0016\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u00192\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\u0015\u0010\u001a\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u001bH\u0080\b\u001a\r\u0010\u001c\u001a\u00020\b*\u00020\u0002H\u0080\b\u001a\r\u0010\u001d\u001a\u00020\u0018*\u00020\u0002H\u0080\b\u001a\u0015\u0010\u001d\u001a\u00020\u0018*\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\r\u0010\u001e\u001a\u00020\f*\u00020\u0002H\u0080\b\u001a\u0015\u0010\u001e\u001a\u00020\f*\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\r\u0010\u001f\u001a\u00020\u0006*\u00020\u0002H\u0080\b\u001a\u0015\u0010 \u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u0018H\u0080\b\u001a\u001d\u0010 \u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u00192\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\r\u0010!\u001a\u00020\u0006*\u00020\u0002H\u0080\b\u001a\r\u0010\"\u001a\u00020\u0014*\u00020\u0002H\u0080\b\u001a\r\u0010#\u001a\u00020\u0014*\u00020\u0002H\u0080\b\u001a\r\u0010$\u001a\u00020\u0006*\u00020\u0002H\u0080\b\u001a\r\u0010%\u001a\u00020\u0006*\u00020\u0002H\u0080\b\u001a\r\u0010&\u001a\u00020'*\u00020\u0002H\u0080\b\u001a\r\u0010(\u001a\u00020'*\u00020\u0002H\u0080\b\u001a\r\u0010)\u001a\u00020**\u00020\u0002H\u0080\b\u001a\u0015\u0010)\u001a\u00020**\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\r\u0010+\u001a\u00020\u0014*\u00020\u0002H\u0080\b\u001a\u000f\u0010,\u001a\u0004\u0018\u00010**\u00020\u0002H\u0080\b\u001a\u0015\u0010-\u001a\u00020**\u00020\u00022\u0006\u0010.\u001a\u00020\u0006H\u0080\b\u001a\u0015\u0010/\u001a\u00020\u0004*\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\u0015\u00100\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\u0015\u00101\u001a\u00020\u0014*\u00020\u00022\u0006\u00102\u001a\u000203H\u0080\b\u001a\u0015\u00104\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0006H\u0080\b\u001a\r\u00105\u001a\u000206*\u00020\u0002H\u0080\b\u001a\r\u00107\u001a\u00020**\u00020\u0002H\u0080\\u00068"}, d2 = {"commonClose", "", "Lokio/RealBufferedSource;", "commonExhausted", "", "commonIndexOf", "", "b", "", "fromIndex", "toIndex", "bytes", "Lokio/ByteString;", "commonIndexOfElement", "targetBytes", "commonPeek", "Lokio/BufferedSource;", "commonRangeEquals", "offset", "bytesOffset", "", "byteCount", "commonRead", "sink", "", "Lokio/Buffer;", "commonReadAll", "Lokio/Sink;", "commonReadByte", "commonReadByteArray", "commonReadByteString", "commonReadDecimalLong", "commonReadFully", "commonReadHexadecimalUnsignedLong", "commonReadInt", "commonReadIntLe", "commonReadLong", "commonReadLongLe", "commonReadShort", "", "commonReadShortLe", "commonReadUtf8", "", "commonReadUtf8CodePoint", "commonReadUtf8Line", "commonReadUtf8LineStrict", "limit", "commonRequest", "commonRequire", "commonSelect", "options", "Lokio/Options;", "commonSkip", "commonTimeout", "Lokio/Timeout;", "commonToString", "okio"}, k = 2, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public final class RealBufferedSourceKt {
public static final long commonRead(RealBufferedSource commonRead, Buffer sink, long j) {
Intrinsics.checkNotNullParameter(commonRead, "$this$commonRead");
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(j >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + j).toString());
}
if (!(!commonRead.closed)) {
throw new IllegalStateException("closed".toString());
}
if (commonRead.bufferField.size() == 0 && commonRead.source.read(commonRead.bufferField, 8192) == -1) {
return -1L;
}
return commonRead.bufferField.read(sink, Math.min(j, commonRead.bufferField.size()));
}
public static final boolean commonExhausted(RealBufferedSource commonExhausted) {
Intrinsics.checkNotNullParameter(commonExhausted, "$this$commonExhausted");
if (!commonExhausted.closed) {
return commonExhausted.bufferField.exhausted() && commonExhausted.source.read(commonExhausted.bufferField, (long) 8192) == -1;
}
throw new IllegalStateException("closed".toString());
}
public static final void commonRequire(RealBufferedSource commonRequire, long j) {
Intrinsics.checkNotNullParameter(commonRequire, "$this$commonRequire");
if (!commonRequire.request(j)) {
throw new EOFException();
}
}
public static final boolean commonRequest(RealBufferedSource commonRequest, long j) {
Intrinsics.checkNotNullParameter(commonRequest, "$this$commonRequest");
if (!(j >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + j).toString());
}
if (!(!commonRequest.closed)) {
throw new IllegalStateException("closed".toString());
}
while (commonRequest.bufferField.size() < j) {
if (commonRequest.source.read(commonRequest.bufferField, 8192) == -1) {
return false;
}
}
return true;
}
public static final byte commonReadByte(RealBufferedSource commonReadByte) {
Intrinsics.checkNotNullParameter(commonReadByte, "$this$commonReadByte");
commonReadByte.require(1L);
return commonReadByte.bufferField.readByte();
}
public static final ByteString commonReadByteString(RealBufferedSource commonReadByteString, long j) {
Intrinsics.checkNotNullParameter(commonReadByteString, "$this$commonReadByteString");
commonReadByteString.require(j);
return commonReadByteString.bufferField.readByteString(j);
}
public static final int commonSelect(RealBufferedSource commonSelect, Options options) {
Intrinsics.checkNotNullParameter(commonSelect, "$this$commonSelect");
Intrinsics.checkNotNullParameter(options, "options");
if (!(!commonSelect.closed)) {
throw new IllegalStateException("closed".toString());
}
do {
int selectPrefix = BufferKt.selectPrefix(commonSelect.bufferField, options, true);
if (selectPrefix != -2) {
if (selectPrefix == -1) {
return -1;
}
commonSelect.bufferField.skip(options.getByteStrings()[selectPrefix].size());
return selectPrefix;
}
} while (commonSelect.source.read(commonSelect.bufferField, 8192) != -1);
return -1;
}
public static final byte[] commonReadByteArray(RealBufferedSource commonReadByteArray, long j) {
Intrinsics.checkNotNullParameter(commonReadByteArray, "$this$commonReadByteArray");
commonReadByteArray.require(j);
return commonReadByteArray.bufferField.readByteArray(j);
}
public static final void commonReadFully(RealBufferedSource commonReadFully, byte[] sink) {
Intrinsics.checkNotNullParameter(commonReadFully, "$this$commonReadFully");
Intrinsics.checkNotNullParameter(sink, "sink");
try {
commonReadFully.require(sink.length);
commonReadFully.bufferField.readFully(sink);
} catch (EOFException e) {
int i = 0;
while (commonReadFully.bufferField.size() > 0) {
int read = commonReadFully.bufferField.read(sink, i, (int) commonReadFully.bufferField.size());
if (read == -1) {
throw new AssertionError();
}
i += read;
}
throw e;
}
}
public static final int commonRead(RealBufferedSource commonRead, byte[] sink, int i, int i2) {
Intrinsics.checkNotNullParameter(commonRead, "$this$commonRead");
Intrinsics.checkNotNullParameter(sink, "sink");
long j = i2;
Util.checkOffsetAndCount(sink.length, i, j);
if (commonRead.bufferField.size() == 0 && commonRead.source.read(commonRead.bufferField, 8192) == -1) {
return -1;
}
return commonRead.bufferField.read(sink, i, (int) Math.min(j, commonRead.bufferField.size()));
}
public static final void commonReadFully(RealBufferedSource commonReadFully, Buffer sink, long j) {
Intrinsics.checkNotNullParameter(commonReadFully, "$this$commonReadFully");
Intrinsics.checkNotNullParameter(sink, "sink");
try {
commonReadFully.require(j);
commonReadFully.bufferField.readFully(sink, j);
} catch (EOFException e) {
sink.writeAll(commonReadFully.bufferField);
throw e;
}
}
public static final long commonReadAll(RealBufferedSource commonReadAll, Sink sink) {
Intrinsics.checkNotNullParameter(commonReadAll, "$this$commonReadAll");
Intrinsics.checkNotNullParameter(sink, "sink");
long j = 0;
while (commonReadAll.source.read(commonReadAll.bufferField, 8192) != -1) {
long completeSegmentByteCount = commonReadAll.bufferField.completeSegmentByteCount();
if (completeSegmentByteCount > 0) {
j += completeSegmentByteCount;
sink.write(commonReadAll.bufferField, completeSegmentByteCount);
}
}
if (commonReadAll.bufferField.size() <= 0) {
return j;
}
long size = j + commonReadAll.bufferField.size();
sink.write(commonReadAll.bufferField, commonReadAll.bufferField.size());
return size;
}
public static final String commonReadUtf8(RealBufferedSource commonReadUtf8, long j) {
Intrinsics.checkNotNullParameter(commonReadUtf8, "$this$commonReadUtf8");
commonReadUtf8.require(j);
return commonReadUtf8.bufferField.readUtf8(j);
}
public static final String commonReadUtf8Line(RealBufferedSource commonReadUtf8Line) {
Intrinsics.checkNotNullParameter(commonReadUtf8Line, "$this$commonReadUtf8Line");
long indexOf = commonReadUtf8Line.indexOf((byte) 10);
if (indexOf != -1) {
return BufferKt.readUtf8Line(commonReadUtf8Line.bufferField, indexOf);
}
if (commonReadUtf8Line.bufferField.size() != 0) {
return commonReadUtf8Line.readUtf8(commonReadUtf8Line.bufferField.size());
}
return null;
}
public static final String commonReadUtf8LineStrict(RealBufferedSource commonReadUtf8LineStrict, long j) {
Intrinsics.checkNotNullParameter(commonReadUtf8LineStrict, "$this$commonReadUtf8LineStrict");
if (!(j >= 0)) {
throw new IllegalArgumentException(("limit < 0: " + j).toString());
}
long j2 = j == Long.MAX_VALUE ? Long.MAX_VALUE : j + 1;
byte b = (byte) 10;
long indexOf = commonReadUtf8LineStrict.indexOf(b, 0L, j2);
if (indexOf != -1) {
return BufferKt.readUtf8Line(commonReadUtf8LineStrict.bufferField, indexOf);
}
if (j2 < Long.MAX_VALUE && commonReadUtf8LineStrict.request(j2) && commonReadUtf8LineStrict.bufferField.getByte(j2 - 1) == ((byte) 13) && commonReadUtf8LineStrict.request(1 + j2) && commonReadUtf8LineStrict.bufferField.getByte(j2) == b) {
return BufferKt.readUtf8Line(commonReadUtf8LineStrict.bufferField, j2);
}
Buffer buffer = new Buffer();
commonReadUtf8LineStrict.bufferField.copyTo(buffer, 0L, Math.min(32, commonReadUtf8LineStrict.bufferField.size()));
throw new EOFException("\\n not found: limit=" + Math.min(commonReadUtf8LineStrict.bufferField.size(), j) + " content=" + buffer.readByteString().hex() + "");
}
public static final int commonReadUtf8CodePoint(RealBufferedSource commonReadUtf8CodePoint) {
Intrinsics.checkNotNullParameter(commonReadUtf8CodePoint, "$this$commonReadUtf8CodePoint");
commonReadUtf8CodePoint.require(1L);
byte b = commonReadUtf8CodePoint.bufferField.getByte(0L);
if ((b & 224) == 192) {
commonReadUtf8CodePoint.require(2L);
} else if ((b & 240) == 224) {
commonReadUtf8CodePoint.require(3L);
} else if ((b & 248) == 240) {
commonReadUtf8CodePoint.require(4L);
}
return commonReadUtf8CodePoint.bufferField.readUtf8CodePoint();
}
public static final short commonReadShort(RealBufferedSource commonReadShort) {
Intrinsics.checkNotNullParameter(commonReadShort, "$this$commonReadShort");
commonReadShort.require(2L);
return commonReadShort.bufferField.readShort();
}
public static final short commonReadShortLe(RealBufferedSource commonReadShortLe) {
Intrinsics.checkNotNullParameter(commonReadShortLe, "$this$commonReadShortLe");
commonReadShortLe.require(2L);
return commonReadShortLe.bufferField.readShortLe();
}
public static final int commonReadInt(RealBufferedSource commonReadInt) {
Intrinsics.checkNotNullParameter(commonReadInt, "$this$commonReadInt");
commonReadInt.require(4L);
return commonReadInt.bufferField.readInt();
}
public static final int commonReadIntLe(RealBufferedSource commonReadIntLe) {
Intrinsics.checkNotNullParameter(commonReadIntLe, "$this$commonReadIntLe");
commonReadIntLe.require(4L);
return commonReadIntLe.bufferField.readIntLe();
}
public static final long commonReadLong(RealBufferedSource commonReadLong) {
Intrinsics.checkNotNullParameter(commonReadLong, "$this$commonReadLong");
commonReadLong.require(8L);
return commonReadLong.bufferField.readLong();
}
public static final long commonReadLongLe(RealBufferedSource commonReadLongLe) {
Intrinsics.checkNotNullParameter(commonReadLongLe, "$this$commonReadLongLe");
commonReadLongLe.require(8L);
return commonReadLongLe.bufferField.readLongLe();
}
/* JADX WARN: Code restructure failed: missing block: B:15:0x0031, code lost:
if (r4 == 0) goto L17;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0034, code lost:
r0 = new java.lang.StringBuilder("Expected leading [0-9] or '-' character but was 0x");
r1 = java.lang.Integer.toString(r8, kotlin.text.CharsKt.checkRadix(kotlin.text.CharsKt.checkRadix(16)));
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r1, "java.lang.Integer.toStri…(this, checkRadix(radix))");
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x005d, code lost:
throw new java.lang.NumberFormatException(r0.append(r1).toString());
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final long commonReadDecimalLong(okio.RealBufferedSource r10) {
/*
java.lang.String r0 = "$this$commonReadDecimalLong"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r10, r0)
r0 = 1
r10.require(r0)
r2 = 0
r4 = r2
Ld:
long r6 = r4 + r0
boolean r8 = r10.request(r6)
if (r8 == 0) goto L5e
okio.Buffer r8 = r10.bufferField
byte r8 = r8.getByte(r4)
r9 = 48
byte r9 = (byte) r9
if (r8 < r9) goto L25
r9 = 57
byte r9 = (byte) r9
if (r8 <= r9) goto L2f
L25:
int r4 = (r4 > r2 ? 1 : (r4 == r2 ? 0 : -1))
if (r4 != 0) goto L31
r5 = 45
byte r5 = (byte) r5
if (r8 == r5) goto L2f
goto L31
L2f:
r4 = r6
goto Ld
L31:
if (r4 == 0) goto L34
goto L5e
L34:
java.lang.NumberFormatException r10 = new java.lang.NumberFormatException
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "Expected leading [0-9] or '-' character but was 0x"
r0.<init>(r1)
r1 = 16
int r1 = kotlin.text.CharsKt.checkRadix(r1)
int r1 = kotlin.text.CharsKt.checkRadix(r1)
java.lang.String r1 = java.lang.Integer.toString(r8, r1)
java.lang.String r2 = "java.lang.Integer.toStri…(this, checkRadix(radix))"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r1, r2)
java.lang.StringBuilder r0 = r0.append(r1)
java.lang.String r0 = r0.toString()
r10.<init>(r0)
java.lang.Throwable r10 = (java.lang.Throwable) r10
throw r10
L5e:
okio.Buffer r10 = r10.bufferField
long r0 = r10.readDecimalLong()
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: okio.internal.RealBufferedSourceKt.commonReadDecimalLong(okio.RealBufferedSource):long");
}
public static final long commonReadHexadecimalUnsignedLong(RealBufferedSource commonReadHexadecimalUnsignedLong) {
byte b;
Intrinsics.checkNotNullParameter(commonReadHexadecimalUnsignedLong, "$this$commonReadHexadecimalUnsignedLong");
commonReadHexadecimalUnsignedLong.require(1L);
int i = 0;
while (true) {
int i2 = i + 1;
if (!commonReadHexadecimalUnsignedLong.request(i2)) {
break;
}
b = commonReadHexadecimalUnsignedLong.bufferField.getByte(i);
if ((b < ((byte) 48) || b > ((byte) 57)) && ((b < ((byte) 97) || b > ((byte) LocationRequestCompat.QUALITY_BALANCED_POWER_ACCURACY)) && (b < ((byte) 65) || b > ((byte) 70)))) {
break;
}
i = i2;
}
if (i == 0) {
StringBuilder sb = new StringBuilder("Expected leading [0-9a-fA-F] character but was 0x");
String num = Integer.toString(b, CharsKt.checkRadix(CharsKt.checkRadix(16)));
Intrinsics.checkNotNullExpressionValue(num, "java.lang.Integer.toStri…(this, checkRadix(radix))");
throw new NumberFormatException(sb.append(num).toString());
}
return commonReadHexadecimalUnsignedLong.bufferField.readHexadecimalUnsignedLong();
}
public static final void commonSkip(RealBufferedSource commonSkip, long j) {
Intrinsics.checkNotNullParameter(commonSkip, "$this$commonSkip");
if (!(!commonSkip.closed)) {
throw new IllegalStateException("closed".toString());
}
while (j > 0) {
if (commonSkip.bufferField.size() == 0 && commonSkip.source.read(commonSkip.bufferField, 8192) == -1) {
throw new EOFException();
}
long min = Math.min(j, commonSkip.bufferField.size());
commonSkip.bufferField.skip(min);
j -= min;
}
}
public static final long commonIndexOf(RealBufferedSource commonIndexOf, byte b, long j, long j2) {
Intrinsics.checkNotNullParameter(commonIndexOf, "$this$commonIndexOf");
if (!(!commonIndexOf.closed)) {
throw new IllegalStateException("closed".toString());
}
if (!(0 <= j && j2 >= j)) {
throw new IllegalArgumentException(("fromIndex=" + j + " toIndex=" + j2).toString());
}
while (j < j2) {
long indexOf = commonIndexOf.bufferField.indexOf(b, j, j2);
if (indexOf == -1) {
long size = commonIndexOf.bufferField.size();
if (size >= j2 || commonIndexOf.source.read(commonIndexOf.bufferField, 8192) == -1) {
break;
}
j = Math.max(j, size);
} else {
return indexOf;
}
}
return -1L;
}
public static final long commonIndexOf(RealBufferedSource commonIndexOf, ByteString bytes, long j) {
Intrinsics.checkNotNullParameter(commonIndexOf, "$this$commonIndexOf");
Intrinsics.checkNotNullParameter(bytes, "bytes");
if (!(!commonIndexOf.closed)) {
throw new IllegalStateException("closed".toString());
}
while (true) {
long indexOf = commonIndexOf.bufferField.indexOf(bytes, j);
if (indexOf != -1) {
return indexOf;
}
long size = commonIndexOf.bufferField.size();
if (commonIndexOf.source.read(commonIndexOf.bufferField, 8192) == -1) {
return -1L;
}
j = Math.max(j, (size - bytes.size()) + 1);
}
}
public static final long commonIndexOfElement(RealBufferedSource commonIndexOfElement, ByteString targetBytes, long j) {
Intrinsics.checkNotNullParameter(commonIndexOfElement, "$this$commonIndexOfElement");
Intrinsics.checkNotNullParameter(targetBytes, "targetBytes");
if (!(!commonIndexOfElement.closed)) {
throw new IllegalStateException("closed".toString());
}
while (true) {
long indexOfElement = commonIndexOfElement.bufferField.indexOfElement(targetBytes, j);
if (indexOfElement != -1) {
return indexOfElement;
}
long size = commonIndexOfElement.bufferField.size();
if (commonIndexOfElement.source.read(commonIndexOfElement.bufferField, 8192) == -1) {
return -1L;
}
j = Math.max(j, size);
}
}
public static final boolean commonRangeEquals(RealBufferedSource commonRangeEquals, long j, ByteString bytes, int i, int i2) {
Intrinsics.checkNotNullParameter(commonRangeEquals, "$this$commonRangeEquals");
Intrinsics.checkNotNullParameter(bytes, "bytes");
if (!(!commonRangeEquals.closed)) {
throw new IllegalStateException("closed".toString());
}
if (j < 0 || i < 0 || i2 < 0 || bytes.size() - i < i2) {
return false;
}
for (int i3 = 0; i3 < i2; i3++) {
long j2 = i3 + j;
if (!commonRangeEquals.request(1 + j2) || commonRangeEquals.bufferField.getByte(j2) != bytes.getByte(i + i3)) {
return false;
}
}
return true;
}
public static final BufferedSource commonPeek(RealBufferedSource commonPeek) {
Intrinsics.checkNotNullParameter(commonPeek, "$this$commonPeek");
return Okio.buffer(new PeekSource(commonPeek));
}
public static final void commonClose(RealBufferedSource commonClose) {
Intrinsics.checkNotNullParameter(commonClose, "$this$commonClose");
if (commonClose.closed) {
return;
}
commonClose.closed = true;
commonClose.source.close();
commonClose.bufferField.clear();
}
public static final Timeout commonTimeout(RealBufferedSource commonTimeout) {
Intrinsics.checkNotNullParameter(commonTimeout, "$this$commonTimeout");
return commonTimeout.source.getTimeout();
}
public static final String commonToString(RealBufferedSource commonToString) {
Intrinsics.checkNotNullParameter(commonToString, "$this$commonToString");
return "buffer(" + commonToString.source + ')';
}
public static final ByteString commonReadByteString(RealBufferedSource commonReadByteString) {
Intrinsics.checkNotNullParameter(commonReadByteString, "$this$commonReadByteString");
commonReadByteString.bufferField.writeAll(commonReadByteString.source);
return commonReadByteString.bufferField.readByteString();
}
public static final byte[] commonReadByteArray(RealBufferedSource commonReadByteArray) {
Intrinsics.checkNotNullParameter(commonReadByteArray, "$this$commonReadByteArray");
commonReadByteArray.bufferField.writeAll(commonReadByteArray.source);
return commonReadByteArray.bufferField.readByteArray();
}
public static final String commonReadUtf8(RealBufferedSource commonReadUtf8) {
Intrinsics.checkNotNullParameter(commonReadUtf8, "$this$commonReadUtf8");
commonReadUtf8.bufferField.writeAll(commonReadUtf8.source);
return commonReadUtf8.bufferField.readUtf8();
}
}