mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-24 08:02:37 -06:00
2276 lines
93 KiB
Java
2276 lines
93 KiB
Java
package okio;
|
|
|
|
import androidx.media3.exoplayer.upstream.CmcdHeadersFactory;
|
|
import androidx.work.WorkRequest;
|
|
import com.google.common.base.Ascii;
|
|
import io.flutter.embedding.android.KeyboardMap;
|
|
import io.flutter.plugin.editing.SpellCheckPlugin;
|
|
import io.sentry.ProfilingTraceData;
|
|
import io.sentry.SentryBaseEvent;
|
|
import io.sentry.protocol.SentryStackTrace;
|
|
import io.sentry.protocol.TransactionInfo;
|
|
import java.io.Closeable;
|
|
import java.io.EOFException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.channels.ByteChannel;
|
|
import java.nio.charset.Charset;
|
|
import java.security.InvalidKeyException;
|
|
import java.security.MessageDigest;
|
|
import java.util.Arrays;
|
|
import javax.crypto.Mac;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import kotlin.Deprecated;
|
|
import kotlin.DeprecationLevel;
|
|
import kotlin.Metadata;
|
|
import kotlin.ReplaceWith;
|
|
import kotlin.collections.ArraysKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.StringCompanionObject;
|
|
import kotlin.text.Charsets;
|
|
import kotlin.text.Typography;
|
|
import okhttp3.internal.connection.RealConnection;
|
|
import okio.internal.BufferKt;
|
|
|
|
/* compiled from: Buffer.kt */
|
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000ª\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u001a\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\u0005\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0010\n\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0017\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004:\u0002\u0090\u0001B\u0005¢\u0006\u0002\u0010\u0005J\b\u0010\u0006\u001a\u00020\u0000H\u0016J\u0006\u0010\u0011\u001a\u00020\u0012J\b\u0010\u0013\u001a\u00020\u0000H\u0016J\b\u0010\u0014\u001a\u00020\u0012H\u0016J\u0006\u0010\u0015\u001a\u00020\fJ\u0006\u0010\u0016\u001a\u00020\u0000J$\u0010\u0017\u001a\u00020\u00002\u0006\u0010\u0018\u001a\u00020\u00192\b\b\u0002\u0010\u001a\u001a\u00020\f2\b\b\u0002\u0010\u001b\u001a\u00020\fH\u0007J\u0018\u0010\u0017\u001a\u00020\u00002\u0006\u0010\u0018\u001a\u00020\u00002\b\b\u0002\u0010\u001a\u001a\u00020\fJ \u0010\u0017\u001a\u00020\u00002\u0006\u0010\u0018\u001a\u00020\u00002\b\b\u0002\u0010\u001a\u001a\u00020\f2\u0006\u0010\u001b\u001a\u00020\fJ\u0010\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u001fH\u0002J\b\u0010 \u001a\u00020\u0000H\u0016J\b\u0010!\u001a\u00020\u0000H\u0016J\u0013\u0010\"\u001a\u00020#2\b\u0010$\u001a\u0004\u0018\u00010%H\u0096\u0002J\b\u0010&\u001a\u00020#H\u0016J\b\u0010'\u001a\u00020\u0012H\u0016J\u0016\u0010(\u001a\u00020)2\u0006\u0010*\u001a\u00020\fH\u0087\u0002¢\u0006\u0002\b+J\u0015\u0010+\u001a\u00020)2\u0006\u0010,\u001a\u00020\fH\u0007¢\u0006\u0002\b-J\b\u0010.\u001a\u00020/H\u0016J\u0018\u00100\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u00101\u001a\u00020\u001dH\u0002J\u000e\u00102\u001a\u00020\u001d2\u0006\u00101\u001a\u00020\u001dJ\u000e\u00103\u001a\u00020\u001d2\u0006\u00101\u001a\u00020\u001dJ\u000e\u00104\u001a\u00020\u001d2\u0006\u00101\u001a\u00020\u001dJ\u0010\u00105\u001a\u00020\f2\u0006\u00106\u001a\u00020)H\u0016J\u0018\u00105\u001a\u00020\f2\u0006\u00106\u001a\u00020)2\u0006\u00107\u001a\u00020\fH\u0016J \u00105\u001a\u00020\f2\u0006\u00106\u001a\u00020)2\u0006\u00107\u001a\u00020\f2\u0006\u00108\u001a\u00020\fH\u0016J\u0010\u00105\u001a\u00020\f2\u0006\u00109\u001a\u00020\u001dH\u0016J\u0018\u00105\u001a\u00020\f2\u0006\u00109\u001a\u00020\u001d2\u0006\u00107\u001a\u00020\fH\u0016J\u0010\u0010:\u001a\u00020\f2\u0006\u0010;\u001a\u00020\u001dH\u0016J\u0018\u0010:\u001a\u00020\f2\u0006\u0010;\u001a\u00020\u001d2\u0006\u00107\u001a\u00020\fH\u0016J\b\u0010<\u001a\u00020=H\u0016J\b\u0010>\u001a\u00020#H\u0016J\u0006\u0010?\u001a\u00020\u001dJ\b\u0010@\u001a\u00020\u0019H\u0016J\b\u0010A\u001a\u00020\u0001H\u0016J\u0018\u0010B\u001a\u00020#2\u0006\u0010\u001a\u001a\u00020\f2\u0006\u00109\u001a\u00020\u001dH\u0016J(\u0010B\u001a\u00020#2\u0006\u0010\u001a\u001a\u00020\f2\u0006\u00109\u001a\u00020\u001d2\u0006\u0010C\u001a\u00020/2\u0006\u0010\u001b\u001a\u00020/H\u0016J\u0010\u0010D\u001a\u00020/2\u0006\u0010E\u001a\u00020FH\u0016J\u0010\u0010D\u001a\u00020/2\u0006\u0010E\u001a\u00020GH\u0016J \u0010D\u001a\u00020/2\u0006\u0010E\u001a\u00020G2\u0006\u0010\u001a\u001a\u00020/2\u0006\u0010\u001b\u001a\u00020/H\u0016J\u0018\u0010D\u001a\u00020\f2\u0006\u0010E\u001a\u00020\u00002\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0010\u0010H\u001a\u00020\f2\u0006\u0010E\u001a\u00020IH\u0016J\u0012\u0010J\u001a\u00020K2\b\b\u0002\u0010L\u001a\u00020KH\u0007J\b\u0010M\u001a\u00020)H\u0016J\b\u0010N\u001a\u00020GH\u0016J\u0010\u0010N\u001a\u00020G2\u0006\u0010\u001b\u001a\u00020\fH\u0016J\b\u0010O\u001a\u00020\u001dH\u0016J\u0010\u0010O\u001a\u00020\u001d2\u0006\u0010\u001b\u001a\u00020\fH\u0016J\b\u0010P\u001a\u00020\fH\u0016J\u000e\u0010Q\u001a\u00020\u00002\u0006\u0010R\u001a\u00020=J\u0016\u0010Q\u001a\u00020\u00002\u0006\u0010R\u001a\u00020=2\u0006\u0010\u001b\u001a\u00020\fJ \u0010Q\u001a\u00020\u00122\u0006\u0010R\u001a\u00020=2\u0006\u0010\u001b\u001a\u00020\f2\u0006\u0010S\u001a\u00020#H\u0002J\u0010\u0010T\u001a\u00020\u00122\u0006\u0010E\u001a\u00020GH\u0016J\u0018\u0010T\u001a\u00020\u00122\u0006\u0010E\u001a\u00020\u00002\u0006\u0010\u001b\u001a\u00020\fH\u0016J\b\u0010U\u001a\u00020\fH\u0016J\b\u0010V\u001a\u00020/H\u0016J\b\u0010W\u001a\u00020/H\u0016J\b\u0010X\u001a\u00020\fH\u0016J\b\u0010Y\u001a\u00020\fH\u0016J\b\u0010Z\u001a\u00020[H\u0016J\b\u0010\\\u001a\u00020[H\u0016J\u0010\u0010]\u001a\u00020\u001f2\u0006\u0010^\u001a\u00020_H\u0016J\u0018\u0010]\u001a\u00020\u001f2\u0006\u0010\u001b\u001a\u00020\f2\u0006\u0010^\u001a\u00020_H\u0016J\u0012\u0010`\u001a\u00020K2\b\b\u0002\u0010L\u001a\u00020KH\u0007J\b\u0010a\u001a\u00020\u001fH\u0016J\u0010\u0010a\u001a\u00020\u001f2\u0006\u0010\u001b\u001a\u00020\fH\u0016J\b\u0010b\u001a\u00020/H\u0016J\n\u0010c\u001a\u0004\u0018\u00010\u001fH\u0016J\b\u0010d\u001a\u00020\u001fH\u0016J\u0010\u0010d\u001a\u00020\u001f2\u0006\u0010e\u001a\u00020\fH\u0016J\u0010\u0010f\u001a\u00020#2\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0010\u0010g\u001a\u00020\u00122\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0010\u0010h\u001a\u00020/2\u0006\u0010i\u001a\u00020jH\u0016J\u0006\u0010k\u001a\u00020\u001dJ\u0006\u0010l\u001a\u00020\u001dJ\u0006\u0010m\u001a\u00020\u001dJ\r\u0010\r\u001a\u00020\fH\u0007¢\u0006\u0002\bnJ\u0010\u0010o\u001a\u00020\u00122\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0006\u0010p\u001a\u00020\u001dJ\u000e\u0010p\u001a\u00020\u001d2\u0006\u0010\u001b\u001a\u00020/J\b\u0010q\u001a\u00020rH\u0016J\b\u0010s\u001a\u00020\u001fH\u0016J\u0015\u0010t\u001a\u00020\n2\u0006\u0010u\u001a\u00020/H\u0000¢\u0006\u0002\bvJ\u0010\u0010w\u001a\u00020/2\u0006\u0010x\u001a\u00020FH\u0016J\u0010\u0010w\u001a\u00020\u00002\u0006\u0010x\u001a\u00020GH\u0016J \u0010w\u001a\u00020\u00002\u0006\u0010x\u001a\u00020G2\u0006\u0010\u001a\u001a\u00020/2\u0006\u0010\u001b\u001a\u00020/H\u0016J\u0018\u0010w\u001a\u00020\u00122\u0006\u0010x\u001a\u00020\u00002\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0010\u0010w\u001a\u00020\u00002\u0006\u0010y\u001a\u00020\u001dH\u0016J \u0010w\u001a\u00020\u00002\u0006\u0010y\u001a\u00020\u001d2\u0006\u0010\u001a\u001a\u00020/2\u0006\u0010\u001b\u001a\u00020/H\u0016J\u0018\u0010w\u001a\u00020\u00002\u0006\u0010x\u001a\u00020z2\u0006\u0010\u001b\u001a\u00020\fH\u0016J\u0010\u0010{\u001a\u00020\f2\u0006\u0010x\u001a\u00020zH\u0016J\u0010\u0010|\u001a\u00020\u00002\u0006\u00106\u001a\u00020/H\u0016J\u0010\u0010}\u001a\u00020\u00002\u0006\u0010~\u001a\u00020\fH\u0016J\u0010\u0010\u007f\u001a\u00020\u00002\u0006\u0010~\u001a\u00020\fH\u0016J\u0012\u0010\u0080\u0001\u001a\u00020\u00002\u0007\u0010\u0081\u0001\u001a\u00020/H\u0016J\u0012\u0010\u0082\u0001\u001a\u00020\u00002\u0007\u0010\u0081\u0001\u001a\u00020/H\u0016J\u0011\u0010\u0083\u0001\u001a\u00020\u00002\u0006\u0010~\u001a\u00020\fH\u0016J\u0011\u0010\u0084\u0001\u001a\u00020\u00002\u0006\u0010~\u001a\u00020\fH\u0016J\u0012\u0010\u0085\u0001\u001a\u00020\u00002\u0007\u0010\u0086\u0001\u001a\u00020/H\u0016J\u0012\u0010\u0087\u0001\u001a\u00020\u00002\u0007\u0010\u0086\u0001\u001a\u00020/H\u0016J\u001a\u0010\u0088\u0001\u001a\u00020\u00002\u0007\u0010\u0089\u0001\u001a\u00020\u001f2\u0006\u0010^\u001a\u00020_H\u0016J,\u0010\u0088\u0001\u001a\u00020\u00002\u0007\u0010\u0089\u0001\u001a\u00020\u001f2\u0007\u0010\u008a\u0001\u001a\u00020/2\u0007\u0010\u008b\u0001\u001a\u00020/2\u0006\u0010^\u001a\u00020_H\u0016J\u001b\u0010\u008c\u0001\u001a\u00020\u00002\u0006\u0010\u0018\u001a\u00020\u00192\b\b\u0002\u0010\u001b\u001a\u00020\fH\u0007J\u0012\u0010\u008d\u0001\u001a\u00020\u00002\u0007\u0010\u0089\u0001\u001a\u00020\u001fH\u0016J$\u0010\u008d\u0001\u001a\u00020\u00002\u0007\u0010\u0089\u0001\u001a\u00020\u001f2\u0007\u0010\u008a\u0001\u001a\u00020/2\u0007\u0010\u008b\u0001\u001a\u00020/H\u0016J\u0012\u0010\u008e\u0001\u001a\u00020\u00002\u0007\u0010\u008f\u0001\u001a\u00020/H\u0016R\u0014\u0010\u0006\u001a\u00020\u00008VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\bR\u0014\u0010\t\u001a\u0004\u0018\u00010\n8\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000R&\u0010\r\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\f8G@@X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010¨\u0006\u0091\u0001"}, d2 = {"Lokio/Buffer;", "Lokio/BufferedSource;", "Lokio/BufferedSink;", "", "Ljava/nio/channels/ByteChannel;", "()V", "buffer", "getBuffer", "()Lokio/Buffer;", "head", "Lokio/Segment;", "<set-?>", "", "size", "()J", "setSize$okio", "(J)V", "clear", "", "clone", "close", "completeSegmentByteCount", "copy", "copyTo", "out", "Ljava/io/OutputStream;", "offset", "byteCount", "digest", "Lokio/ByteString;", "algorithm", "", "emit", "emitCompleteSegments", "equals", "", "other", "", "exhausted", "flush", "get", "", "pos", "getByte", "index", "-deprecated_getByte", "hashCode", "", "hmac", "key", "hmacSha1", "hmacSha256", "hmacSha512", "indexOf", "b", "fromIndex", "toIndex", "bytes", "indexOfElement", "targetBytes", "inputStream", "Ljava/io/InputStream;", "isOpen", "md5", "outputStream", "peek", "rangeEquals", "bytesOffset", "read", "sink", "Ljava/nio/ByteBuffer;", "", "readAll", "Lokio/Sink;", "readAndWriteUnsafe", "Lokio/Buffer$UnsafeCursor;", "unsafeCursor", "readByte", "readByteArray", "readByteString", "readDecimalLong", "readFrom", "input", "forever", "readFully", "readHexadecimalUnsignedLong", "readInt", "readIntLe", "readLong", "readLongLe", "readShort", "", "readShortLe", "readString", "charset", "Ljava/nio/charset/Charset;", "readUnsafe", "readUtf8", "readUtf8CodePoint", "readUtf8Line", "readUtf8LineStrict", "limit", SentryBaseEvent.JsonKeys.REQUEST, "require", "select", "options", "Lokio/Options;", "sha1", "sha256", "sha512", "-deprecated_size", "skip", SentryStackTrace.JsonKeys.SNAPSHOT, ProfilingTraceData.TRUNCATION_REASON_TIMEOUT, "Lokio/Timeout;", "toString", "writableSegment", "minimumCapacity", "writableSegment$okio", "write", TransactionInfo.JsonKeys.SOURCE, "byteString", "Lokio/Source;", "writeAll", "writeByte", "writeDecimalLong", "v", "writeHexadecimalUnsignedLong", "writeInt", CmcdHeadersFactory.OBJECT_TYPE_INIT_SEGMENT, "writeIntLe", "writeLong", "writeLongLe", "writeShort", CmcdHeadersFactory.STREAMING_FORMAT_SS, "writeShortLe", "writeString", "string", "beginIndex", SpellCheckPlugin.END_INDEX_KEY, "writeTo", "writeUtf8", "writeUtf8CodePoint", "codePoint", "UnsafeCursor", "okio"}, k = 1, mv = {1, 4, 0})
|
|
/* loaded from: classes3.dex */
|
|
public final class Buffer implements BufferedSource, BufferedSink, Cloneable, ByteChannel {
|
|
public Segment head;
|
|
private long size;
|
|
|
|
public static /* synthetic */ Buffer copyTo$default(Buffer buffer, Buffer buffer2, long j, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
return buffer.copyTo(buffer2, j);
|
|
}
|
|
|
|
public static /* synthetic */ Buffer copyTo$default(Buffer buffer, Buffer buffer2, long j, long j2, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
return buffer.copyTo(buffer2, j, j2);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
|
|
/* renamed from: -deprecated_size, reason: not valid java name and from getter */
|
|
public final long getSize() {
|
|
return this.size;
|
|
}
|
|
|
|
@Override // okio.BufferedSource, okio.BufferedSink
|
|
/* renamed from: buffer */
|
|
public Buffer getBufferField() {
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
}
|
|
|
|
public final Buffer copyTo(OutputStream outputStream) throws IOException {
|
|
return copyTo$default(this, outputStream, 0L, 0L, 6, (Object) null);
|
|
}
|
|
|
|
public final Buffer copyTo(OutputStream outputStream, long j) throws IOException {
|
|
return copyTo$default(this, outputStream, j, 0L, 4, (Object) null);
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer emit() {
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer emitCompleteSegments() {
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public boolean exhausted() {
|
|
return this.size == 0;
|
|
}
|
|
|
|
@Override // okio.BufferedSink, okio.Sink, java.io.Flushable
|
|
public void flush() {
|
|
}
|
|
|
|
@Override // okio.BufferedSource, okio.BufferedSink
|
|
public Buffer getBuffer() {
|
|
return this;
|
|
}
|
|
|
|
@Override // java.nio.channels.Channel
|
|
public boolean isOpen() {
|
|
return true;
|
|
}
|
|
|
|
public final UnsafeCursor readAndWriteUnsafe() {
|
|
return readAndWriteUnsafe$default(this, null, 1, null);
|
|
}
|
|
|
|
public final UnsafeCursor readUnsafe() {
|
|
return readUnsafe$default(this, null, 1, null);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public boolean request(long byteCount) {
|
|
return this.size >= byteCount;
|
|
}
|
|
|
|
public final void setSize$okio(long j) {
|
|
this.size = j;
|
|
}
|
|
|
|
public final long size() {
|
|
return this.size;
|
|
}
|
|
|
|
public final Buffer writeTo(OutputStream outputStream) throws IOException {
|
|
return writeTo$default(this, outputStream, 0L, 2, null);
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public OutputStream outputStream() {
|
|
return new OutputStream() { // from class: okio.Buffer$outputStream$1
|
|
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
}
|
|
|
|
@Override // java.io.OutputStream, java.io.Flushable
|
|
public void flush() {
|
|
}
|
|
|
|
@Override // java.io.OutputStream
|
|
public void write(int b) {
|
|
Buffer.this.writeByte(b);
|
|
}
|
|
|
|
@Override // java.io.OutputStream
|
|
public void write(byte[] data, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(data, "data");
|
|
Buffer.this.write(data, offset, byteCount);
|
|
}
|
|
|
|
public String toString() {
|
|
return Buffer.this + ".outputStream()";
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public void require(long byteCount) throws EOFException {
|
|
if (this.size < byteCount) {
|
|
throw new EOFException();
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public BufferedSource peek() {
|
|
return Okio.buffer(new PeekSource(this));
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public InputStream inputStream() {
|
|
return new InputStream() { // from class: okio.Buffer$inputStream$1
|
|
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read() {
|
|
if (Buffer.this.size() > 0) {
|
|
return Buffer.this.readByte() & 255;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read(byte[] sink, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
return Buffer.this.read(sink, offset, byteCount);
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int available() {
|
|
return (int) Math.min(Buffer.this.size(), Integer.MAX_VALUE);
|
|
}
|
|
|
|
public String toString() {
|
|
return Buffer.this + ".inputStream()";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static /* synthetic */ Buffer copyTo$default(Buffer buffer, OutputStream outputStream, long j, long j2, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
long j3 = j;
|
|
if ((i & 4) != 0) {
|
|
j2 = buffer.size - j3;
|
|
}
|
|
return buffer.copyTo(outputStream, j3, j2);
|
|
}
|
|
|
|
public final Buffer copyTo(OutputStream out, long offset, long byteCount) throws IOException {
|
|
Intrinsics.checkNotNullParameter(out, "out");
|
|
Util.checkOffsetAndCount(this.size, offset, byteCount);
|
|
if (byteCount == 0) {
|
|
return this;
|
|
}
|
|
Segment segment = this.head;
|
|
while (true) {
|
|
Intrinsics.checkNotNull(segment);
|
|
if (offset < segment.limit - segment.pos) {
|
|
break;
|
|
}
|
|
offset -= segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
}
|
|
while (byteCount > 0) {
|
|
Intrinsics.checkNotNull(segment);
|
|
int min = (int) Math.min(segment.limit - r9, byteCount);
|
|
out.write(segment.data, (int) (segment.pos + offset), min);
|
|
byteCount -= min;
|
|
segment = segment.next;
|
|
offset = 0;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final Buffer copyTo(Buffer out, long offset) {
|
|
Intrinsics.checkNotNullParameter(out, "out");
|
|
return copyTo(out, offset, this.size - offset);
|
|
}
|
|
|
|
public static /* synthetic */ Buffer writeTo$default(Buffer buffer, OutputStream outputStream, long j, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
j = buffer.size;
|
|
}
|
|
return buffer.writeTo(outputStream, j);
|
|
}
|
|
|
|
public final Buffer writeTo(OutputStream out, long byteCount) throws IOException {
|
|
Intrinsics.checkNotNullParameter(out, "out");
|
|
Util.checkOffsetAndCount(this.size, 0L, byteCount);
|
|
Segment segment = this.head;
|
|
while (byteCount > 0) {
|
|
Intrinsics.checkNotNull(segment);
|
|
int min = (int) Math.min(byteCount, segment.limit - segment.pos);
|
|
out.write(segment.data, segment.pos, min);
|
|
segment.pos += min;
|
|
long j = min;
|
|
this.size -= j;
|
|
byteCount -= j;
|
|
if (segment.pos == segment.limit) {
|
|
Segment pop = segment.pop();
|
|
this.head = pop;
|
|
SegmentPool.recycle(segment);
|
|
segment = pop;
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final Buffer readFrom(InputStream input) throws IOException {
|
|
Intrinsics.checkNotNullParameter(input, "input");
|
|
readFrom(input, Long.MAX_VALUE, true);
|
|
return this;
|
|
}
|
|
|
|
public final Buffer readFrom(InputStream input, long byteCount) throws IOException {
|
|
Intrinsics.checkNotNullParameter(input, "input");
|
|
if (!(byteCount >= 0)) {
|
|
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
|
|
}
|
|
readFrom(input, byteCount, false);
|
|
return this;
|
|
}
|
|
|
|
private final void readFrom(InputStream input, long byteCount, boolean forever) throws IOException {
|
|
while (true) {
|
|
if (byteCount <= 0 && !forever) {
|
|
return;
|
|
}
|
|
Segment writableSegment$okio = writableSegment$okio(1);
|
|
int read = input.read(writableSegment$okio.data, writableSegment$okio.limit, (int) Math.min(byteCount, 8192 - writableSegment$okio.limit));
|
|
if (read == -1) {
|
|
if (writableSegment$okio.pos == writableSegment$okio.limit) {
|
|
this.head = writableSegment$okio.pop();
|
|
SegmentPool.recycle(writableSegment$okio);
|
|
}
|
|
if (!forever) {
|
|
throw new EOFException();
|
|
}
|
|
return;
|
|
}
|
|
writableSegment$okio.limit += read;
|
|
long j = read;
|
|
this.size += j;
|
|
byteCount -= j;
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public short readShortLe() throws EOFException {
|
|
return Util.reverseBytes(readShort());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int readIntLe() throws EOFException {
|
|
return Util.reverseBytes(readInt());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long readLongLe() throws EOFException {
|
|
return Util.reverseBytes(readLong());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readUtf8() {
|
|
return readString(this.size, Charsets.UTF_8);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readUtf8(long byteCount) throws EOFException {
|
|
return readString(byteCount, Charsets.UTF_8);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readString(Charset charset) {
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
return readString(this.size, charset);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readString(long byteCount, Charset charset) throws EOFException {
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
if (!(byteCount >= 0 && byteCount <= ((long) Integer.MAX_VALUE))) {
|
|
throw new IllegalArgumentException(("byteCount: " + byteCount).toString());
|
|
}
|
|
if (this.size < byteCount) {
|
|
throw new EOFException();
|
|
}
|
|
if (byteCount == 0) {
|
|
return "";
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
if (segment.pos + byteCount > segment.limit) {
|
|
return new String(readByteArray(byteCount), charset);
|
|
}
|
|
int i = (int) byteCount;
|
|
String str = new String(segment.data, segment.pos, i, charset);
|
|
segment.pos += i;
|
|
this.size -= byteCount;
|
|
if (segment.pos == segment.limit) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
}
|
|
return str;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readUtf8LineStrict() throws EOFException {
|
|
return readUtf8LineStrict(Long.MAX_VALUE);
|
|
}
|
|
|
|
@Override // java.nio.channels.ReadableByteChannel
|
|
public int read(ByteBuffer sink) throws IOException {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
return -1;
|
|
}
|
|
int min = Math.min(sink.remaining(), segment.limit - segment.pos);
|
|
sink.put(segment.data, segment.pos, min);
|
|
segment.pos += min;
|
|
this.size -= min;
|
|
if (segment.pos == segment.limit) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
}
|
|
return min;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeUtf8(String string) {
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
return writeUtf8(string, 0, string.length());
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeString(String string, Charset charset) {
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
return writeString(string, 0, string.length(), charset);
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeString(String string, int beginIndex, int endIndex, Charset charset) {
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
if (!(beginIndex >= 0)) {
|
|
throw new IllegalArgumentException(("beginIndex < 0: " + beginIndex).toString());
|
|
}
|
|
if (!(endIndex >= beginIndex)) {
|
|
throw new IllegalArgumentException(("endIndex < beginIndex: " + endIndex + " < " + beginIndex).toString());
|
|
}
|
|
if (!(endIndex <= string.length())) {
|
|
throw new IllegalArgumentException(("endIndex > string.length: " + endIndex + " > " + string.length()).toString());
|
|
}
|
|
if (Intrinsics.areEqual(charset, Charsets.UTF_8)) {
|
|
return writeUtf8(string, beginIndex, endIndex);
|
|
}
|
|
String substring = string.substring(beginIndex, endIndex);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
|
|
if (substring == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
|
}
|
|
byte[] bytes = substring.getBytes(charset);
|
|
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
|
|
return write(bytes, 0, bytes.length);
|
|
}
|
|
|
|
@Override // java.nio.channels.WritableByteChannel
|
|
public int write(ByteBuffer source) throws IOException {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
int remaining = source.remaining();
|
|
int i = remaining;
|
|
while (i > 0) {
|
|
Segment writableSegment$okio = writableSegment$okio(1);
|
|
int min = Math.min(i, 8192 - writableSegment$okio.limit);
|
|
source.get(writableSegment$okio.data, writableSegment$okio.limit, min);
|
|
i -= min;
|
|
writableSegment$okio.limit += min;
|
|
}
|
|
this.size += remaining;
|
|
return remaining;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeShortLe(int s) {
|
|
return writeShort((int) Util.reverseBytes((short) s));
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeIntLe(int i) {
|
|
return writeInt(Util.reverseBytes(i));
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeLongLe(long v) {
|
|
return writeLong(Util.reverseBytes(v));
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOf(byte b) {
|
|
return indexOf(b, 0L, Long.MAX_VALUE);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOf(byte b, long fromIndex) {
|
|
return indexOf(b, fromIndex, Long.MAX_VALUE);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOf(ByteString bytes) throws IOException {
|
|
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
|
return indexOf(bytes, 0L);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOfElement(ByteString targetBytes) {
|
|
Intrinsics.checkNotNullParameter(targetBytes, "targetBytes");
|
|
return indexOfElement(targetBytes, 0L);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public boolean rangeEquals(long offset, ByteString bytes) {
|
|
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
|
return rangeEquals(offset, bytes, 0, bytes.size());
|
|
}
|
|
|
|
@Override // okio.Source
|
|
/* renamed from: timeout */
|
|
public Timeout getThis$0() {
|
|
return Timeout.NONE;
|
|
}
|
|
|
|
public final ByteString md5() {
|
|
return digest("MD5");
|
|
}
|
|
|
|
public final ByteString sha1() {
|
|
return digest("SHA-1");
|
|
}
|
|
|
|
public final ByteString sha256() {
|
|
return digest("SHA-256");
|
|
}
|
|
|
|
public final ByteString sha512() {
|
|
return digest("SHA-512");
|
|
}
|
|
|
|
private final ByteString digest(String algorithm) {
|
|
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
|
|
Segment segment = this.head;
|
|
if (segment != null) {
|
|
messageDigest.update(segment.data, segment.pos, segment.limit - segment.pos);
|
|
Segment segment2 = segment.next;
|
|
Intrinsics.checkNotNull(segment2);
|
|
while (segment2 != segment) {
|
|
messageDigest.update(segment2.data, segment2.pos, segment2.limit - segment2.pos);
|
|
segment2 = segment2.next;
|
|
Intrinsics.checkNotNull(segment2);
|
|
}
|
|
}
|
|
byte[] digest = messageDigest.digest();
|
|
Intrinsics.checkNotNullExpressionValue(digest, "messageDigest.digest()");
|
|
return new ByteString(digest);
|
|
}
|
|
|
|
public final ByteString hmacSha1(ByteString key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return hmac("HmacSHA1", key);
|
|
}
|
|
|
|
public final ByteString hmacSha256(ByteString key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return hmac("HmacSHA256", key);
|
|
}
|
|
|
|
public final ByteString hmacSha512(ByteString key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return hmac("HmacSHA512", key);
|
|
}
|
|
|
|
private final ByteString hmac(String algorithm, ByteString key) {
|
|
try {
|
|
Mac mac = Mac.getInstance(algorithm);
|
|
mac.init(new SecretKeySpec(key.internalArray$okio(), algorithm));
|
|
Segment segment = this.head;
|
|
if (segment != null) {
|
|
mac.update(segment.data, segment.pos, segment.limit - segment.pos);
|
|
Segment segment2 = segment.next;
|
|
Intrinsics.checkNotNull(segment2);
|
|
while (segment2 != segment) {
|
|
mac.update(segment2.data, segment2.pos, segment2.limit - segment2.pos);
|
|
segment2 = segment2.next;
|
|
Intrinsics.checkNotNull(segment2);
|
|
}
|
|
}
|
|
byte[] doFinal = mac.doFinal();
|
|
Intrinsics.checkNotNullExpressionValue(doFinal, "mac.doFinal()");
|
|
return new ByteString(doFinal);
|
|
} catch (InvalidKeyException e) {
|
|
throw new IllegalArgumentException(e);
|
|
}
|
|
}
|
|
|
|
public String toString() {
|
|
return snapshot().toString();
|
|
}
|
|
|
|
public Buffer clone() {
|
|
return copy();
|
|
}
|
|
|
|
public static /* synthetic */ UnsafeCursor readUnsafe$default(Buffer buffer, UnsafeCursor unsafeCursor, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
unsafeCursor = new UnsafeCursor();
|
|
}
|
|
return buffer.readUnsafe(unsafeCursor);
|
|
}
|
|
|
|
public final UnsafeCursor readUnsafe(UnsafeCursor unsafeCursor) {
|
|
Intrinsics.checkNotNullParameter(unsafeCursor, "unsafeCursor");
|
|
if (!(unsafeCursor.buffer == null)) {
|
|
throw new IllegalStateException("already attached to a buffer".toString());
|
|
}
|
|
unsafeCursor.buffer = this;
|
|
unsafeCursor.readWrite = false;
|
|
return unsafeCursor;
|
|
}
|
|
|
|
public static /* synthetic */ UnsafeCursor readAndWriteUnsafe$default(Buffer buffer, UnsafeCursor unsafeCursor, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
unsafeCursor = new UnsafeCursor();
|
|
}
|
|
return buffer.readAndWriteUnsafe(unsafeCursor);
|
|
}
|
|
|
|
public final UnsafeCursor readAndWriteUnsafe(UnsafeCursor unsafeCursor) {
|
|
Intrinsics.checkNotNullParameter(unsafeCursor, "unsafeCursor");
|
|
if (!(unsafeCursor.buffer == null)) {
|
|
throw new IllegalStateException("already attached to a buffer".toString());
|
|
}
|
|
unsafeCursor.buffer = this;
|
|
unsafeCursor.readWrite = true;
|
|
return unsafeCursor;
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to operator function", replaceWith = @ReplaceWith(expression = "this[index]", imports = {}))
|
|
/* renamed from: -deprecated_getByte, reason: not valid java name */
|
|
public final byte m7405deprecated_getByte(long index) {
|
|
return getByte(index);
|
|
}
|
|
|
|
/* compiled from: Buffer.kt */
|
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0007\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0016J\u000e\u0010\u0012\u001a\u00020\n2\u0006\u0010\u0013\u001a\u00020\bJ\u0006\u0010\u0014\u001a\u00020\bJ\u000e\u0010\u0015\u001a\u00020\n2\u0006\u0010\u0016\u001a\u00020\nJ\u000e\u0010\u0017\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nR\u0014\u0010\u0003\u001a\u0004\u0018\u00010\u00048\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\u0004\u0018\u00010\u00068\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0007\u001a\u00020\b8\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\t\u001a\u00020\n8\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u000b\u001a\u00020\f8\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u000f\u001a\u00020\b8\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lokio/Buffer$UnsafeCursor;", "Ljava/io/Closeable;", "()V", "buffer", "Lokio/Buffer;", "data", "", "end", "", "offset", "", "readWrite", "", "segment", "Lokio/Segment;", "start", "close", "", "expandBuffer", "minByteCount", "next", "resizeBuffer", "newSize", "seek", "okio"}, k = 1, mv = {1, 4, 0})
|
|
/* loaded from: classes3.dex */
|
|
public static final class UnsafeCursor implements Closeable {
|
|
public Buffer buffer;
|
|
public byte[] data;
|
|
public boolean readWrite;
|
|
private Segment segment;
|
|
public long offset = -1;
|
|
public int start = -1;
|
|
public int end = -1;
|
|
|
|
public final int next() {
|
|
long j = this.offset;
|
|
Buffer buffer = this.buffer;
|
|
Intrinsics.checkNotNull(buffer);
|
|
if (!(j != buffer.size())) {
|
|
throw new IllegalStateException("no more bytes".toString());
|
|
}
|
|
long j2 = this.offset;
|
|
return seek(j2 == -1 ? 0L : j2 + (this.end - this.start));
|
|
}
|
|
|
|
public final int seek(long offset) {
|
|
Buffer buffer = this.buffer;
|
|
if (buffer == null) {
|
|
throw new IllegalStateException("not attached to a buffer".toString());
|
|
}
|
|
if (offset < -1 || offset > buffer.size()) {
|
|
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
|
|
String format = String.format("offset=%s > size=%s", Arrays.copyOf(new Object[]{Long.valueOf(offset), Long.valueOf(buffer.size())}, 2));
|
|
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
|
|
throw new ArrayIndexOutOfBoundsException(format);
|
|
}
|
|
if (offset == -1 || offset == buffer.size()) {
|
|
this.segment = null;
|
|
this.offset = offset;
|
|
this.data = null;
|
|
this.start = -1;
|
|
this.end = -1;
|
|
return -1;
|
|
}
|
|
long size = buffer.size();
|
|
Segment segment = buffer.head;
|
|
Segment segment2 = buffer.head;
|
|
Segment segment3 = this.segment;
|
|
long j = 0;
|
|
if (segment3 != null) {
|
|
long j2 = this.offset;
|
|
int i = this.start;
|
|
Intrinsics.checkNotNull(segment3);
|
|
long j3 = j2 - (i - segment3.pos);
|
|
if (j3 > offset) {
|
|
segment2 = this.segment;
|
|
size = j3;
|
|
} else {
|
|
segment = this.segment;
|
|
j = j3;
|
|
}
|
|
}
|
|
if (size - offset > offset - j) {
|
|
while (true) {
|
|
Intrinsics.checkNotNull(segment);
|
|
if (offset < (segment.limit - segment.pos) + j) {
|
|
break;
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
}
|
|
} else {
|
|
while (size > offset) {
|
|
Intrinsics.checkNotNull(segment2);
|
|
segment2 = segment2.prev;
|
|
Intrinsics.checkNotNull(segment2);
|
|
size -= segment2.limit - segment2.pos;
|
|
}
|
|
j = size;
|
|
segment = segment2;
|
|
}
|
|
if (this.readWrite) {
|
|
Intrinsics.checkNotNull(segment);
|
|
if (segment.shared) {
|
|
Segment unsharedCopy = segment.unsharedCopy();
|
|
if (buffer.head == segment) {
|
|
buffer.head = unsharedCopy;
|
|
}
|
|
segment = segment.push(unsharedCopy);
|
|
Segment segment4 = segment.prev;
|
|
Intrinsics.checkNotNull(segment4);
|
|
segment4.pop();
|
|
}
|
|
}
|
|
this.segment = segment;
|
|
this.offset = offset;
|
|
Intrinsics.checkNotNull(segment);
|
|
this.data = segment.data;
|
|
this.start = segment.pos + ((int) (offset - j));
|
|
int i2 = segment.limit;
|
|
this.end = i2;
|
|
return i2 - this.start;
|
|
}
|
|
|
|
public final long resizeBuffer(long newSize) {
|
|
Buffer buffer = this.buffer;
|
|
if (buffer == null) {
|
|
throw new IllegalStateException("not attached to a buffer".toString());
|
|
}
|
|
if (!this.readWrite) {
|
|
throw new IllegalStateException("resizeBuffer() only permitted for read/write buffers".toString());
|
|
}
|
|
long size = buffer.size();
|
|
int i = 1;
|
|
if (newSize <= size) {
|
|
if (!(newSize >= 0)) {
|
|
throw new IllegalArgumentException(("newSize < 0: " + newSize).toString());
|
|
}
|
|
long j = size - newSize;
|
|
while (true) {
|
|
if (j <= 0) {
|
|
break;
|
|
}
|
|
Segment segment = buffer.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment segment2 = segment.prev;
|
|
Intrinsics.checkNotNull(segment2);
|
|
long j2 = segment2.limit - segment2.pos;
|
|
if (j2 <= j) {
|
|
buffer.head = segment2.pop();
|
|
SegmentPool.recycle(segment2);
|
|
j -= j2;
|
|
} else {
|
|
segment2.limit -= (int) j;
|
|
break;
|
|
}
|
|
}
|
|
this.segment = null;
|
|
this.offset = newSize;
|
|
this.data = null;
|
|
this.start = -1;
|
|
this.end = -1;
|
|
} else if (newSize > size) {
|
|
long j3 = newSize - size;
|
|
boolean z = true;
|
|
while (j3 > 0) {
|
|
Segment writableSegment$okio = buffer.writableSegment$okio(i);
|
|
int min = (int) Math.min(j3, 8192 - writableSegment$okio.limit);
|
|
writableSegment$okio.limit += min;
|
|
j3 -= min;
|
|
if (z) {
|
|
this.segment = writableSegment$okio;
|
|
this.offset = size;
|
|
this.data = writableSegment$okio.data;
|
|
this.start = writableSegment$okio.limit - min;
|
|
this.end = writableSegment$okio.limit;
|
|
z = false;
|
|
}
|
|
i = 1;
|
|
}
|
|
}
|
|
buffer.setSize$okio(newSize);
|
|
return size;
|
|
}
|
|
|
|
public final long expandBuffer(int minByteCount) {
|
|
if (!(minByteCount > 0)) {
|
|
throw new IllegalArgumentException(("minByteCount <= 0: " + minByteCount).toString());
|
|
}
|
|
if (!(minByteCount <= 8192)) {
|
|
throw new IllegalArgumentException(("minByteCount > Segment.SIZE: " + minByteCount).toString());
|
|
}
|
|
Buffer buffer = this.buffer;
|
|
if (buffer == null) {
|
|
throw new IllegalStateException("not attached to a buffer".toString());
|
|
}
|
|
if (!this.readWrite) {
|
|
throw new IllegalStateException("expandBuffer() only permitted for read/write buffers".toString());
|
|
}
|
|
long size = buffer.size();
|
|
Segment writableSegment$okio = buffer.writableSegment$okio(minByteCount);
|
|
int i = 8192 - writableSegment$okio.limit;
|
|
writableSegment$okio.limit = 8192;
|
|
long j = i;
|
|
buffer.setSize$okio(size + j);
|
|
this.segment = writableSegment$okio;
|
|
this.offset = size;
|
|
this.data = writableSegment$okio.data;
|
|
this.start = 8192 - i;
|
|
this.end = 8192;
|
|
return j;
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
if (!(this.buffer != null)) {
|
|
throw new IllegalStateException("not attached to a buffer".toString());
|
|
}
|
|
this.buffer = null;
|
|
this.segment = null;
|
|
this.offset = -1L;
|
|
this.data = null;
|
|
this.start = -1;
|
|
this.end = -1;
|
|
}
|
|
}
|
|
|
|
public final Buffer copyTo(Buffer out, long offset, long byteCount) {
|
|
Intrinsics.checkNotNullParameter(out, "out");
|
|
Util.checkOffsetAndCount(size(), offset, byteCount);
|
|
if (byteCount != 0) {
|
|
out.setSize$okio(out.size() + byteCount);
|
|
Segment segment = this.head;
|
|
while (true) {
|
|
Intrinsics.checkNotNull(segment);
|
|
if (offset < segment.limit - segment.pos) {
|
|
break;
|
|
}
|
|
offset -= segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
}
|
|
while (byteCount > 0) {
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment sharedCopy = segment.sharedCopy();
|
|
sharedCopy.pos += (int) offset;
|
|
sharedCopy.limit = Math.min(sharedCopy.pos + ((int) byteCount), sharedCopy.limit);
|
|
Segment segment2 = out.head;
|
|
if (segment2 == null) {
|
|
sharedCopy.prev = sharedCopy;
|
|
sharedCopy.next = sharedCopy.prev;
|
|
out.head = sharedCopy.next;
|
|
} else {
|
|
Intrinsics.checkNotNull(segment2);
|
|
Segment segment3 = segment2.prev;
|
|
Intrinsics.checkNotNull(segment3);
|
|
segment3.push(sharedCopy);
|
|
}
|
|
byteCount -= sharedCopy.limit - sharedCopy.pos;
|
|
segment = segment.next;
|
|
offset = 0;
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final long completeSegmentByteCount() {
|
|
long size = size();
|
|
if (size == 0) {
|
|
return 0L;
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment segment2 = segment.prev;
|
|
Intrinsics.checkNotNull(segment2);
|
|
if (segment2.limit < 8192 && segment2.owner) {
|
|
size -= segment2.limit - segment2.pos;
|
|
}
|
|
return size;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public byte readByte() throws EOFException {
|
|
if (size() == 0) {
|
|
throw new EOFException();
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
int i = segment.pos;
|
|
int i2 = segment.limit;
|
|
int i3 = i + 1;
|
|
byte b = segment.data[i];
|
|
setSize$okio(size() - 1);
|
|
if (i3 == i2) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
} else {
|
|
segment.pos = i3;
|
|
}
|
|
return b;
|
|
}
|
|
|
|
public final byte getByte(long pos) {
|
|
Util.checkOffsetAndCount(size(), pos, 1L);
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
Segment segment2 = null;
|
|
Intrinsics.checkNotNull(null);
|
|
byte[] bArr = segment2.data;
|
|
throw null;
|
|
}
|
|
if (size() - pos < pos) {
|
|
long size = size();
|
|
while (size > pos) {
|
|
segment = segment.prev;
|
|
Intrinsics.checkNotNull(segment);
|
|
size -= segment.limit - segment.pos;
|
|
}
|
|
Intrinsics.checkNotNull(segment);
|
|
return segment.data[(int) ((segment.pos + pos) - size)];
|
|
}
|
|
long j = 0;
|
|
while (true) {
|
|
long j2 = (segment.limit - segment.pos) + j;
|
|
if (j2 > pos) {
|
|
Intrinsics.checkNotNull(segment);
|
|
return segment.data[(int) ((segment.pos + pos) - j)];
|
|
}
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j = j2;
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public short readShort() throws EOFException {
|
|
if (size() < 2) {
|
|
throw new EOFException();
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
int i = segment.pos;
|
|
int i2 = segment.limit;
|
|
if (i2 - i < 2) {
|
|
return (short) ((readByte() & 255) | ((readByte() & 255) << 8));
|
|
}
|
|
byte[] bArr = segment.data;
|
|
int i3 = i + 1;
|
|
int i4 = (bArr[i] & 255) << 8;
|
|
int i5 = i + 2;
|
|
int i6 = (bArr[i3] & 255) | i4;
|
|
setSize$okio(size() - 2);
|
|
if (i5 == i2) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
} else {
|
|
segment.pos = i5;
|
|
}
|
|
return (short) i6;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int readInt() throws EOFException {
|
|
if (size() < 4) {
|
|
throw new EOFException();
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
int i = segment.pos;
|
|
int i2 = segment.limit;
|
|
if (i2 - i < 4) {
|
|
return (readByte() & 255) | ((readByte() & 255) << 24) | ((readByte() & 255) << 16) | ((readByte() & 255) << 8);
|
|
}
|
|
byte[] bArr = segment.data;
|
|
int i3 = i + 3;
|
|
int i4 = ((bArr[i + 1] & 255) << 16) | ((bArr[i] & 255) << 24) | ((bArr[i + 2] & 255) << 8);
|
|
int i5 = i + 4;
|
|
int i6 = (bArr[i3] & 255) | i4;
|
|
setSize$okio(size() - 4);
|
|
if (i5 == i2) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
} else {
|
|
segment.pos = i5;
|
|
}
|
|
return i6;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long readLong() throws EOFException {
|
|
if (size() < 8) {
|
|
throw new EOFException();
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
int i = segment.pos;
|
|
int i2 = segment.limit;
|
|
if (i2 - i < 8) {
|
|
return ((readInt() & KeyboardMap.kValueMask) << 32) | (KeyboardMap.kValueMask & readInt());
|
|
}
|
|
byte[] bArr = segment.data;
|
|
int i3 = i + 7;
|
|
long j = ((bArr[i] & 255) << 56) | ((bArr[i + 1] & 255) << 48) | ((bArr[i + 2] & 255) << 40) | ((bArr[i + 3] & 255) << 32) | ((bArr[i + 4] & 255) << 24) | ((bArr[i + 5] & 255) << 16) | ((bArr[i + 6] & 255) << 8);
|
|
int i4 = i + 8;
|
|
long j2 = j | (bArr[i3] & 255);
|
|
setSize$okio(size() - 8);
|
|
if (i4 == i2) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
} else {
|
|
segment.pos = i4;
|
|
}
|
|
return j2;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:35:0x00a1 */
|
|
/* JADX WARN: Removed duplicated region for block: B:37:0x00af */
|
|
/* JADX WARN: Removed duplicated region for block: B:46:0x00b3 A[EDGE_INSN: B:46:0x00b3->B:40:0x00b3 BREAK A[LOOP:0: B:4:0x0011->B:45:?], SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:47:0x00ab */
|
|
@Override // okio.BufferedSource
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public long readDecimalLong() throws java.io.EOFException {
|
|
/*
|
|
r15 = this;
|
|
long r0 = r15.size()
|
|
r2 = 0
|
|
int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
|
|
if (r0 == 0) goto Lc1
|
|
r0 = 0
|
|
r4 = -7
|
|
r1 = r0
|
|
r5 = r4
|
|
r3 = r2
|
|
r2 = r1
|
|
L11:
|
|
okio.Segment r7 = r15.head
|
|
kotlin.jvm.internal.Intrinsics.checkNotNull(r7)
|
|
byte[] r8 = r7.data
|
|
int r9 = r7.pos
|
|
int r10 = r7.limit
|
|
L1c:
|
|
if (r9 >= r10) goto L9f
|
|
r11 = r8[r9]
|
|
r12 = 48
|
|
byte r12 = (byte) r12
|
|
if (r11 < r12) goto L6f
|
|
r13 = 57
|
|
byte r13 = (byte) r13
|
|
if (r11 > r13) goto L6f
|
|
int r12 = r12 - r11
|
|
r13 = -922337203685477580(0xf333333333333334, double:-8.390303882365713E246)
|
|
int r13 = (r3 > r13 ? 1 : (r3 == r13 ? 0 : -1))
|
|
if (r13 < 0) goto L42
|
|
if (r13 != 0) goto L3c
|
|
long r13 = (long) r12
|
|
int r13 = (r13 > r5 ? 1 : (r13 == r5 ? 0 : -1))
|
|
if (r13 >= 0) goto L3c
|
|
goto L42
|
|
L3c:
|
|
r13 = 10
|
|
long r3 = r3 * r13
|
|
long r11 = (long) r12
|
|
long r3 = r3 + r11
|
|
goto L7b
|
|
L42:
|
|
okio.Buffer r15 = new okio.Buffer
|
|
r15.<init>()
|
|
okio.Buffer r15 = r15.writeDecimalLong(r3)
|
|
okio.Buffer r15 = r15.writeByte(r11)
|
|
if (r1 != 0) goto L54
|
|
r15.readByte()
|
|
L54:
|
|
java.lang.NumberFormatException r0 = new java.lang.NumberFormatException
|
|
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
|
java.lang.String r2 = "Number too large: "
|
|
r1.<init>(r2)
|
|
java.lang.String r15 = r15.readUtf8()
|
|
java.lang.StringBuilder r15 = r1.append(r15)
|
|
java.lang.String r15 = r15.toString()
|
|
r0.<init>(r15)
|
|
java.lang.Throwable r0 = (java.lang.Throwable) r0
|
|
throw r0
|
|
L6f:
|
|
r12 = 45
|
|
byte r12 = (byte) r12
|
|
r13 = 1
|
|
if (r11 != r12) goto L80
|
|
if (r0 != 0) goto L80
|
|
r11 = 1
|
|
long r5 = r5 - r11
|
|
r1 = r13
|
|
L7b:
|
|
int r9 = r9 + 1
|
|
int r0 = r0 + 1
|
|
goto L1c
|
|
L80:
|
|
if (r0 == 0) goto L84
|
|
r2 = r13
|
|
goto L9f
|
|
L84:
|
|
java.lang.NumberFormatException r15 = 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)
|
|
java.lang.String r1 = okio.Util.toHexString(r11)
|
|
java.lang.StringBuilder r0 = r0.append(r1)
|
|
java.lang.String r0 = r0.toString()
|
|
r15.<init>(r0)
|
|
java.lang.Throwable r15 = (java.lang.Throwable) r15
|
|
throw r15
|
|
L9f:
|
|
if (r9 != r10) goto Lab
|
|
okio.Segment r8 = r7.pop()
|
|
r15.head = r8
|
|
okio.SegmentPool.recycle(r7)
|
|
goto Lad
|
|
Lab:
|
|
r7.pos = r9
|
|
Lad:
|
|
if (r2 != 0) goto Lb3
|
|
okio.Segment r7 = r15.head
|
|
if (r7 != 0) goto L11
|
|
Lb3:
|
|
long r5 = r15.size()
|
|
long r7 = (long) r0
|
|
long r5 = r5 - r7
|
|
r15.setSize$okio(r5)
|
|
if (r1 == 0) goto Lbf
|
|
goto Lc0
|
|
Lbf:
|
|
long r3 = -r3
|
|
Lc0:
|
|
return r3
|
|
Lc1:
|
|
java.io.EOFException r15 = new java.io.EOFException
|
|
r15.<init>()
|
|
java.lang.Throwable r15 = (java.lang.Throwable) r15
|
|
throw r15
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okio.Buffer.readDecimalLong():long");
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:31:0x009c */
|
|
/* JADX WARN: Removed duplicated region for block: B:33:0x00aa */
|
|
/* JADX WARN: Removed duplicated region for block: B:39:0x00ae A[EDGE_INSN: B:39:0x00ae->B:36:0x00ae BREAK A[LOOP:0: B:4:0x000d->B:38:?], SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:40:0x00a6 */
|
|
@Override // okio.BufferedSource
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public long readHexadecimalUnsignedLong() throws java.io.EOFException {
|
|
/*
|
|
r14 = this;
|
|
long r0 = r14.size()
|
|
r2 = 0
|
|
int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
|
|
if (r0 == 0) goto Lb8
|
|
r0 = 0
|
|
r1 = r0
|
|
r4 = r2
|
|
Ld:
|
|
okio.Segment r6 = r14.head
|
|
kotlin.jvm.internal.Intrinsics.checkNotNull(r6)
|
|
byte[] r7 = r6.data
|
|
int r8 = r6.pos
|
|
int r9 = r6.limit
|
|
L18:
|
|
if (r8 >= r9) goto L9a
|
|
r10 = r7[r8]
|
|
r11 = 48
|
|
byte r11 = (byte) r11
|
|
if (r10 < r11) goto L29
|
|
r12 = 57
|
|
byte r12 = (byte) r12
|
|
if (r10 > r12) goto L29
|
|
int r11 = r10 - r11
|
|
goto L43
|
|
L29:
|
|
r11 = 97
|
|
byte r11 = (byte) r11
|
|
if (r10 < r11) goto L38
|
|
r12 = 102(0x66, float:1.43E-43)
|
|
byte r12 = (byte) r12
|
|
if (r10 > r12) goto L38
|
|
L33:
|
|
int r11 = r10 - r11
|
|
int r11 = r11 + 10
|
|
goto L43
|
|
L38:
|
|
r11 = 65
|
|
byte r11 = (byte) r11
|
|
if (r10 < r11) goto L7b
|
|
r12 = 70
|
|
byte r12 = (byte) r12
|
|
if (r10 > r12) goto L7b
|
|
goto L33
|
|
L43:
|
|
r12 = -1152921504606846976(0xf000000000000000, double:-3.105036184601418E231)
|
|
long r12 = r12 & r4
|
|
int r12 = (r12 > r2 ? 1 : (r12 == r2 ? 0 : -1))
|
|
if (r12 != 0) goto L53
|
|
r10 = 4
|
|
long r4 = r4 << r10
|
|
long r10 = (long) r11
|
|
long r4 = r4 | r10
|
|
int r8 = r8 + 1
|
|
int r0 = r0 + 1
|
|
goto L18
|
|
L53:
|
|
okio.Buffer r14 = new okio.Buffer
|
|
r14.<init>()
|
|
okio.Buffer r14 = r14.writeHexadecimalUnsignedLong(r4)
|
|
okio.Buffer r14 = r14.writeByte(r10)
|
|
java.lang.NumberFormatException r0 = new java.lang.NumberFormatException
|
|
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
|
java.lang.String r2 = "Number too large: "
|
|
r1.<init>(r2)
|
|
java.lang.String r14 = r14.readUtf8()
|
|
java.lang.StringBuilder r14 = r1.append(r14)
|
|
java.lang.String r14 = r14.toString()
|
|
r0.<init>(r14)
|
|
java.lang.Throwable r0 = (java.lang.Throwable) r0
|
|
throw r0
|
|
L7b:
|
|
if (r0 == 0) goto L7f
|
|
r1 = 1
|
|
goto L9a
|
|
L7f:
|
|
java.lang.NumberFormatException r14 = new java.lang.NumberFormatException
|
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
|
java.lang.String r1 = "Expected leading [0-9a-fA-F] character but was 0x"
|
|
r0.<init>(r1)
|
|
java.lang.String r1 = okio.Util.toHexString(r10)
|
|
java.lang.StringBuilder r0 = r0.append(r1)
|
|
java.lang.String r0 = r0.toString()
|
|
r14.<init>(r0)
|
|
java.lang.Throwable r14 = (java.lang.Throwable) r14
|
|
throw r14
|
|
L9a:
|
|
if (r8 != r9) goto La6
|
|
okio.Segment r7 = r6.pop()
|
|
r14.head = r7
|
|
okio.SegmentPool.recycle(r6)
|
|
goto La8
|
|
La6:
|
|
r6.pos = r8
|
|
La8:
|
|
if (r1 != 0) goto Lae
|
|
okio.Segment r6 = r14.head
|
|
if (r6 != 0) goto Ld
|
|
Lae:
|
|
long r1 = r14.size()
|
|
long r6 = (long) r0
|
|
long r1 = r1 - r6
|
|
r14.setSize$okio(r1)
|
|
return r4
|
|
Lb8:
|
|
java.io.EOFException r14 = new java.io.EOFException
|
|
r14.<init>()
|
|
java.lang.Throwable r14 = (java.lang.Throwable) r14
|
|
throw r14
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okio.Buffer.readHexadecimalUnsignedLong():long");
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public ByteString readByteString() {
|
|
return readByteString(size());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public ByteString readByteString(long byteCount) throws EOFException {
|
|
if (!(byteCount >= 0 && byteCount <= ((long) Integer.MAX_VALUE))) {
|
|
throw new IllegalArgumentException(("byteCount: " + byteCount).toString());
|
|
}
|
|
if (size() < byteCount) {
|
|
throw new EOFException();
|
|
}
|
|
if (byteCount >= 4096) {
|
|
ByteString snapshot = snapshot((int) byteCount);
|
|
skip(byteCount);
|
|
return snapshot;
|
|
}
|
|
return new ByteString(readByteArray(byteCount));
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int select(Options options) {
|
|
Intrinsics.checkNotNullParameter(options, "options");
|
|
int selectPrefix$default = BufferKt.selectPrefix$default(this, options, false, 2, null);
|
|
if (selectPrefix$default == -1) {
|
|
return -1;
|
|
}
|
|
skip(options.getByteStrings()[selectPrefix$default].size());
|
|
return selectPrefix$default;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public void readFully(Buffer sink, long byteCount) throws EOFException {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
if (size() < byteCount) {
|
|
sink.write(this, size());
|
|
throw new EOFException();
|
|
}
|
|
sink.write(this, byteCount);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long readAll(Sink sink) throws IOException {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
long size = size();
|
|
if (size > 0) {
|
|
sink.write(this, size);
|
|
}
|
|
return size;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readUtf8Line() throws EOFException {
|
|
long indexOf = indexOf((byte) 10);
|
|
if (indexOf != -1) {
|
|
return BufferKt.readUtf8Line(this, indexOf);
|
|
}
|
|
if (size() != 0) {
|
|
return readUtf8(size());
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public String readUtf8LineStrict(long limit) throws EOFException {
|
|
if (!(limit >= 0)) {
|
|
throw new IllegalArgumentException(("limit < 0: " + limit).toString());
|
|
}
|
|
long j = limit != Long.MAX_VALUE ? limit + 1 : Long.MAX_VALUE;
|
|
byte b = (byte) 10;
|
|
long indexOf = indexOf(b, 0L, j);
|
|
if (indexOf != -1) {
|
|
return BufferKt.readUtf8Line(this, indexOf);
|
|
}
|
|
if (j < size() && getByte(j - 1) == ((byte) 13) && getByte(j) == b) {
|
|
return BufferKt.readUtf8Line(this, j);
|
|
}
|
|
Buffer buffer = new Buffer();
|
|
copyTo(buffer, 0L, Math.min(32, size()));
|
|
throw new EOFException("\\n not found: limit=" + Math.min(size(), limit) + " content=" + buffer.readByteString().hex() + Typography.ellipsis);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int readUtf8CodePoint() throws EOFException {
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
if (size() == 0) {
|
|
throw new EOFException();
|
|
}
|
|
byte b = getByte(0L);
|
|
if ((b & 128) == 0) {
|
|
i = b & Byte.MAX_VALUE;
|
|
i3 = 0;
|
|
i2 = 1;
|
|
} else if ((b & 224) == 192) {
|
|
i = b & Ascii.US;
|
|
i2 = 2;
|
|
i3 = 128;
|
|
} else if ((b & 240) == 224) {
|
|
i = b & Ascii.SI;
|
|
i2 = 3;
|
|
i3 = 2048;
|
|
} else {
|
|
if ((b & 248) != 240) {
|
|
skip(1L);
|
|
return Utf8.REPLACEMENT_CODE_POINT;
|
|
}
|
|
i = b & 7;
|
|
i2 = 4;
|
|
i3 = 65536;
|
|
}
|
|
long j = i2;
|
|
if (size() < j) {
|
|
throw new EOFException("size < " + i2 + ": " + size() + " (to read code point prefixed 0x" + Util.toHexString(b) + ')');
|
|
}
|
|
for (int i4 = 1; i4 < i2; i4++) {
|
|
long j2 = i4;
|
|
byte b2 = getByte(j2);
|
|
if ((b2 & 192) != 128) {
|
|
skip(j2);
|
|
return Utf8.REPLACEMENT_CODE_POINT;
|
|
}
|
|
i = (i << 6) | (b2 & Utf8.REPLACEMENT_BYTE);
|
|
}
|
|
skip(j);
|
|
return i > 1114111 ? Utf8.REPLACEMENT_CODE_POINT : ((55296 <= i && 57343 >= i) || i < i3) ? Utf8.REPLACEMENT_CODE_POINT : i;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public byte[] readByteArray() {
|
|
return readByteArray(size());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public byte[] readByteArray(long byteCount) throws EOFException {
|
|
if (!(byteCount >= 0 && byteCount <= ((long) Integer.MAX_VALUE))) {
|
|
throw new IllegalArgumentException(("byteCount: " + byteCount).toString());
|
|
}
|
|
if (size() < byteCount) {
|
|
throw new EOFException();
|
|
}
|
|
byte[] bArr = new byte[(int) byteCount];
|
|
readFully(bArr);
|
|
return bArr;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int read(byte[] sink) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
return read(sink, 0, sink.length);
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public void readFully(byte[] sink) throws EOFException {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
int i = 0;
|
|
while (i < sink.length) {
|
|
int read = read(sink, i, sink.length - i);
|
|
if (read == -1) {
|
|
throw new EOFException();
|
|
}
|
|
i += read;
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public int read(byte[] sink, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
Util.checkOffsetAndCount(sink.length, offset, byteCount);
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
return -1;
|
|
}
|
|
int min = Math.min(byteCount, segment.limit - segment.pos);
|
|
ArraysKt.copyInto(segment.data, sink, offset, segment.pos, segment.pos + min);
|
|
segment.pos += min;
|
|
setSize$okio(size() - min);
|
|
if (segment.pos != segment.limit) {
|
|
return min;
|
|
}
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
return min;
|
|
}
|
|
|
|
public final void clear() {
|
|
skip(size());
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public void skip(long byteCount) throws EOFException {
|
|
while (byteCount > 0) {
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
throw new EOFException();
|
|
}
|
|
int min = (int) Math.min(byteCount, segment.limit - segment.pos);
|
|
long j = min;
|
|
setSize$okio(size() - j);
|
|
byteCount -= j;
|
|
segment.pos += min;
|
|
if (segment.pos == segment.limit) {
|
|
this.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer write(ByteString byteString) {
|
|
Intrinsics.checkNotNullParameter(byteString, "byteString");
|
|
byteString.write$okio(this, 0, byteString.size());
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer write(ByteString byteString, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(byteString, "byteString");
|
|
byteString.write$okio(this, offset, byteCount);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeUtf8(String string, int beginIndex, int endIndex) {
|
|
int i;
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
if (!(beginIndex >= 0)) {
|
|
throw new IllegalArgumentException(("beginIndex < 0: " + beginIndex).toString());
|
|
}
|
|
if (!(endIndex >= beginIndex)) {
|
|
throw new IllegalArgumentException(("endIndex < beginIndex: " + endIndex + " < " + beginIndex).toString());
|
|
}
|
|
if (!(endIndex <= string.length())) {
|
|
throw new IllegalArgumentException(("endIndex > string.length: " + endIndex + " > " + string.length()).toString());
|
|
}
|
|
while (beginIndex < endIndex) {
|
|
char charAt = string.charAt(beginIndex);
|
|
if (charAt < 128) {
|
|
Segment writableSegment$okio = writableSegment$okio(1);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i2 = writableSegment$okio.limit - beginIndex;
|
|
int min = Math.min(endIndex, 8192 - i2);
|
|
i = beginIndex + 1;
|
|
bArr[beginIndex + i2] = (byte) charAt;
|
|
while (i < min) {
|
|
char charAt2 = string.charAt(i);
|
|
if (charAt2 >= 128) {
|
|
break;
|
|
}
|
|
bArr[i + i2] = (byte) charAt2;
|
|
i++;
|
|
}
|
|
int i3 = (i2 + i) - writableSegment$okio.limit;
|
|
writableSegment$okio.limit += i3;
|
|
setSize$okio(size() + i3);
|
|
} else {
|
|
if (charAt < 2048) {
|
|
Segment writableSegment$okio2 = writableSegment$okio(2);
|
|
writableSegment$okio2.data[writableSegment$okio2.limit] = (byte) ((charAt >> 6) | 192);
|
|
writableSegment$okio2.data[writableSegment$okio2.limit + 1] = (byte) ((charAt & '?') | 128);
|
|
writableSegment$okio2.limit += 2;
|
|
setSize$okio(size() + 2);
|
|
} else if (charAt < 55296 || charAt > 57343) {
|
|
Segment writableSegment$okio3 = writableSegment$okio(3);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit] = (byte) ((charAt >> '\f') | 224);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit + 1] = (byte) ((63 & (charAt >> 6)) | 128);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit + 2] = (byte) ((charAt & '?') | 128);
|
|
writableSegment$okio3.limit += 3;
|
|
setSize$okio(size() + 3);
|
|
} else {
|
|
i = beginIndex + 1;
|
|
char charAt3 = i < endIndex ? string.charAt(i) : (char) 0;
|
|
if (charAt > 56319 || 56320 > charAt3 || 57343 < charAt3) {
|
|
writeByte(63);
|
|
} else {
|
|
int i4 = (((charAt & 1023) << 10) | (charAt3 & 1023)) + 65536;
|
|
Segment writableSegment$okio4 = writableSegment$okio(4);
|
|
writableSegment$okio4.data[writableSegment$okio4.limit] = (byte) ((i4 >> 18) | 240);
|
|
writableSegment$okio4.data[writableSegment$okio4.limit + 1] = (byte) (((i4 >> 12) & 63) | 128);
|
|
writableSegment$okio4.data[writableSegment$okio4.limit + 2] = (byte) (((i4 >> 6) & 63) | 128);
|
|
writableSegment$okio4.data[writableSegment$okio4.limit + 3] = (byte) ((i4 & 63) | 128);
|
|
writableSegment$okio4.limit += 4;
|
|
setSize$okio(size() + 4);
|
|
beginIndex += 2;
|
|
}
|
|
}
|
|
beginIndex++;
|
|
}
|
|
beginIndex = i;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeUtf8CodePoint(int codePoint) {
|
|
if (codePoint < 128) {
|
|
writeByte(codePoint);
|
|
} else if (codePoint < 2048) {
|
|
Segment writableSegment$okio = writableSegment$okio(2);
|
|
writableSegment$okio.data[writableSegment$okio.limit] = (byte) ((codePoint >> 6) | 192);
|
|
writableSegment$okio.data[writableSegment$okio.limit + 1] = (byte) ((codePoint & 63) | 128);
|
|
writableSegment$okio.limit += 2;
|
|
setSize$okio(size() + 2);
|
|
} else if (55296 <= codePoint && 57343 >= codePoint) {
|
|
writeByte(63);
|
|
} else if (codePoint < 65536) {
|
|
Segment writableSegment$okio2 = writableSegment$okio(3);
|
|
writableSegment$okio2.data[writableSegment$okio2.limit] = (byte) ((codePoint >> 12) | 224);
|
|
writableSegment$okio2.data[writableSegment$okio2.limit + 1] = (byte) (((codePoint >> 6) & 63) | 128);
|
|
writableSegment$okio2.data[writableSegment$okio2.limit + 2] = (byte) ((codePoint & 63) | 128);
|
|
writableSegment$okio2.limit += 3;
|
|
setSize$okio(size() + 3);
|
|
} else if (codePoint <= 1114111) {
|
|
Segment writableSegment$okio3 = writableSegment$okio(4);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit] = (byte) ((codePoint >> 18) | 240);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit + 1] = (byte) (((codePoint >> 12) & 63) | 128);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit + 2] = (byte) (((codePoint >> 6) & 63) | 128);
|
|
writableSegment$okio3.data[writableSegment$okio3.limit + 3] = (byte) ((codePoint & 63) | 128);
|
|
writableSegment$okio3.limit += 4;
|
|
setSize$okio(size() + 4);
|
|
} else {
|
|
throw new IllegalArgumentException("Unexpected code point: 0x" + Util.toHexString(codePoint));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer write(byte[] source) {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
return write(source, 0, source.length);
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer write(byte[] source, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
long j = byteCount;
|
|
Util.checkOffsetAndCount(source.length, offset, j);
|
|
int i = byteCount + offset;
|
|
while (offset < i) {
|
|
Segment writableSegment$okio = writableSegment$okio(1);
|
|
int min = Math.min(i - offset, 8192 - writableSegment$okio.limit);
|
|
int i2 = offset + min;
|
|
ArraysKt.copyInto(source, writableSegment$okio.data, writableSegment$okio.limit, offset, i2);
|
|
writableSegment$okio.limit += min;
|
|
offset = i2;
|
|
}
|
|
setSize$okio(size() + j);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public long writeAll(Source source) throws IOException {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
long j = 0;
|
|
while (true) {
|
|
long read = source.read(this, 8192);
|
|
if (read == -1) {
|
|
return j;
|
|
}
|
|
j += read;
|
|
}
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer write(Source source, long byteCount) throws IOException {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
while (byteCount > 0) {
|
|
long read = source.read(this, byteCount);
|
|
if (read == -1) {
|
|
throw new EOFException();
|
|
}
|
|
byteCount -= read;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeByte(int b) {
|
|
Segment writableSegment$okio = writableSegment$okio(1);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i = writableSegment$okio.limit;
|
|
writableSegment$okio.limit = i + 1;
|
|
bArr[i] = (byte) b;
|
|
setSize$okio(size() + 1);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeShort(int s) {
|
|
Segment writableSegment$okio = writableSegment$okio(2);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i = writableSegment$okio.limit;
|
|
bArr[i] = (byte) ((s >>> 8) & 255);
|
|
bArr[i + 1] = (byte) (s & 255);
|
|
writableSegment$okio.limit = i + 2;
|
|
setSize$okio(size() + 2);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeInt(int i) {
|
|
Segment writableSegment$okio = writableSegment$okio(4);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i2 = writableSegment$okio.limit;
|
|
bArr[i2] = (byte) ((i >>> 24) & 255);
|
|
bArr[i2 + 1] = (byte) ((i >>> 16) & 255);
|
|
bArr[i2 + 2] = (byte) ((i >>> 8) & 255);
|
|
bArr[i2 + 3] = (byte) (i & 255);
|
|
writableSegment$okio.limit = i2 + 4;
|
|
setSize$okio(size() + 4);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeLong(long v) {
|
|
Segment writableSegment$okio = writableSegment$okio(8);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i = writableSegment$okio.limit;
|
|
bArr[i] = (byte) ((v >>> 56) & 255);
|
|
bArr[i + 1] = (byte) ((v >>> 48) & 255);
|
|
bArr[i + 2] = (byte) ((v >>> 40) & 255);
|
|
bArr[i + 3] = (byte) ((v >>> 32) & 255);
|
|
bArr[i + 4] = (byte) ((v >>> 24) & 255);
|
|
bArr[i + 5] = (byte) ((v >>> 16) & 255);
|
|
bArr[i + 6] = (byte) ((v >>> 8) & 255);
|
|
bArr[i + 7] = (byte) (v & 255);
|
|
writableSegment$okio.limit = i + 8;
|
|
setSize$okio(size() + 8);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeDecimalLong(long v) {
|
|
boolean z;
|
|
if (v == 0) {
|
|
return writeByte(48);
|
|
}
|
|
int i = 1;
|
|
if (v < 0) {
|
|
v = -v;
|
|
if (v < 0) {
|
|
return writeUtf8("-9223372036854775808");
|
|
}
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
if (v >= 100000000) {
|
|
i = v < 1000000000000L ? v < RealConnection.IDLE_CONNECTION_HEALTHY_NS ? v < 1000000000 ? 9 : 10 : v < 100000000000L ? 11 : 12 : v < 1000000000000000L ? v < 10000000000000L ? 13 : v < 100000000000000L ? 14 : 15 : v < 100000000000000000L ? v < 10000000000000000L ? 16 : 17 : v < 1000000000000000000L ? 18 : 19;
|
|
} else if (v >= WorkRequest.MIN_BACKOFF_MILLIS) {
|
|
i = v < 1000000 ? v < 100000 ? 5 : 6 : v < 10000000 ? 7 : 8;
|
|
} else if (v >= 100) {
|
|
i = v < 1000 ? 3 : 4;
|
|
} else if (v >= 10) {
|
|
i = 2;
|
|
}
|
|
if (z) {
|
|
i++;
|
|
}
|
|
Segment writableSegment$okio = writableSegment$okio(i);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i2 = writableSegment$okio.limit + i;
|
|
while (v != 0) {
|
|
long j = 10;
|
|
i2--;
|
|
bArr[i2] = BufferKt.getHEX_DIGIT_BYTES()[(int) (v % j)];
|
|
v /= j;
|
|
}
|
|
if (z) {
|
|
bArr[i2 - 1] = (byte) 45;
|
|
}
|
|
writableSegment$okio.limit += i;
|
|
setSize$okio(size() + i);
|
|
return this;
|
|
}
|
|
|
|
@Override // okio.BufferedSink
|
|
public Buffer writeHexadecimalUnsignedLong(long v) {
|
|
if (v == 0) {
|
|
return writeByte(48);
|
|
}
|
|
long j = (v >>> 1) | v;
|
|
long j2 = j | (j >>> 2);
|
|
long j3 = j2 | (j2 >>> 4);
|
|
long j4 = j3 | (j3 >>> 8);
|
|
long j5 = j4 | (j4 >>> 16);
|
|
long j6 = j5 | (j5 >>> 32);
|
|
long j7 = j6 - ((j6 >>> 1) & 6148914691236517205L);
|
|
long j8 = ((j7 >>> 2) & 3689348814741910323L) + (j7 & 3689348814741910323L);
|
|
long j9 = ((j8 >>> 4) + j8) & 1085102592571150095L;
|
|
long j10 = j9 + (j9 >>> 8);
|
|
long j11 = j10 + (j10 >>> 16);
|
|
int i = (int) ((((j11 & 63) + ((j11 >>> 32) & 63)) + 3) / 4);
|
|
Segment writableSegment$okio = writableSegment$okio(i);
|
|
byte[] bArr = writableSegment$okio.data;
|
|
int i2 = writableSegment$okio.limit;
|
|
for (int i3 = (writableSegment$okio.limit + i) - 1; i3 >= i2; i3--) {
|
|
bArr[i3] = BufferKt.getHEX_DIGIT_BYTES()[(int) (15 & v)];
|
|
v >>>= 4;
|
|
}
|
|
writableSegment$okio.limit += i;
|
|
setSize$okio(size() + i);
|
|
return this;
|
|
}
|
|
|
|
public final Segment writableSegment$okio(int minimumCapacity) {
|
|
if (!(minimumCapacity >= 1 && minimumCapacity <= 8192)) {
|
|
throw new IllegalArgumentException("unexpected capacity".toString());
|
|
}
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
Segment take = SegmentPool.take();
|
|
this.head = take;
|
|
take.prev = take;
|
|
take.next = take;
|
|
return take;
|
|
}
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment segment2 = segment.prev;
|
|
Intrinsics.checkNotNull(segment2);
|
|
if (segment2.limit + minimumCapacity > 8192 || !segment2.owner) {
|
|
segment2 = segment2.push(SegmentPool.take());
|
|
}
|
|
return segment2;
|
|
}
|
|
|
|
@Override // okio.Sink
|
|
public void write(Buffer source, long byteCount) {
|
|
Segment segment;
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
if (!(source != this)) {
|
|
throw new IllegalArgumentException("source == this".toString());
|
|
}
|
|
Util.checkOffsetAndCount(source.size(), 0L, byteCount);
|
|
while (byteCount > 0) {
|
|
Segment segment2 = source.head;
|
|
Intrinsics.checkNotNull(segment2);
|
|
int i = segment2.limit;
|
|
Intrinsics.checkNotNull(source.head);
|
|
if (byteCount < i - r2.pos) {
|
|
Segment segment3 = this.head;
|
|
if (segment3 != null) {
|
|
Intrinsics.checkNotNull(segment3);
|
|
segment = segment3.prev;
|
|
} else {
|
|
segment = null;
|
|
}
|
|
if (segment != null && segment.owner) {
|
|
if ((segment.limit + byteCount) - (segment.shared ? 0 : segment.pos) <= 8192) {
|
|
Segment segment4 = source.head;
|
|
Intrinsics.checkNotNull(segment4);
|
|
segment4.writeTo(segment, (int) byteCount);
|
|
source.setSize$okio(source.size() - byteCount);
|
|
setSize$okio(size() + byteCount);
|
|
return;
|
|
}
|
|
}
|
|
Segment segment5 = source.head;
|
|
Intrinsics.checkNotNull(segment5);
|
|
source.head = segment5.split((int) byteCount);
|
|
}
|
|
Segment segment6 = source.head;
|
|
Intrinsics.checkNotNull(segment6);
|
|
long j = segment6.limit - segment6.pos;
|
|
source.head = segment6.pop();
|
|
Segment segment7 = this.head;
|
|
if (segment7 == null) {
|
|
this.head = segment6;
|
|
segment6.prev = segment6;
|
|
segment6.next = segment6.prev;
|
|
} else {
|
|
Intrinsics.checkNotNull(segment7);
|
|
Segment segment8 = segment7.prev;
|
|
Intrinsics.checkNotNull(segment8);
|
|
segment8.push(segment6).compact();
|
|
}
|
|
source.setSize$okio(source.size() - j);
|
|
setSize$okio(size() + j);
|
|
byteCount -= j;
|
|
}
|
|
}
|
|
|
|
@Override // okio.Source
|
|
public long read(Buffer sink, long byteCount) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
if (!(byteCount >= 0)) {
|
|
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
|
|
}
|
|
if (size() == 0) {
|
|
return -1L;
|
|
}
|
|
if (byteCount > size()) {
|
|
byteCount = size();
|
|
}
|
|
sink.write(this, byteCount);
|
|
return byteCount;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOf(byte b, long fromIndex, long toIndex) {
|
|
int i;
|
|
long j = 0;
|
|
if (!(0 <= fromIndex && toIndex >= fromIndex)) {
|
|
throw new IllegalArgumentException(("size=" + size() + " fromIndex=" + fromIndex + " toIndex=" + toIndex).toString());
|
|
}
|
|
if (toIndex > size()) {
|
|
toIndex = size();
|
|
}
|
|
if (fromIndex == toIndex) {
|
|
return -1L;
|
|
}
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
if (size() - fromIndex < fromIndex) {
|
|
j = size();
|
|
while (j > fromIndex) {
|
|
segment = segment.prev;
|
|
Intrinsics.checkNotNull(segment);
|
|
j -= segment.limit - segment.pos;
|
|
}
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
while (j < toIndex) {
|
|
byte[] bArr = segment.data;
|
|
int min = (int) Math.min(segment.limit, (segment.pos + toIndex) - j);
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
while (i < min) {
|
|
if (bArr[i] != b) {
|
|
i++;
|
|
}
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
}
|
|
while (true) {
|
|
long j2 = (segment.limit - segment.pos) + j;
|
|
if (j2 > fromIndex) {
|
|
break;
|
|
}
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j = j2;
|
|
}
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
while (j < toIndex) {
|
|
byte[] bArr2 = segment.data;
|
|
int min2 = (int) Math.min(segment.limit, (segment.pos + toIndex) - j);
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
while (i < min2) {
|
|
if (bArr2[i] != b) {
|
|
i++;
|
|
}
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
return (i - segment.pos) + j;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOf(ByteString bytes, long fromIndex) throws IOException {
|
|
long j = fromIndex;
|
|
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
|
if (!(bytes.size() > 0)) {
|
|
throw new IllegalArgumentException("bytes is empty".toString());
|
|
}
|
|
long j2 = 0;
|
|
if (!(j >= 0)) {
|
|
throw new IllegalArgumentException(("fromIndex < 0: " + j).toString());
|
|
}
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
} else if (size() - j < j) {
|
|
long size = size();
|
|
while (size > j) {
|
|
segment = segment.prev;
|
|
Intrinsics.checkNotNull(segment);
|
|
size -= segment.limit - segment.pos;
|
|
}
|
|
if (segment != null) {
|
|
byte[] internalArray$okio = bytes.internalArray$okio();
|
|
byte b = internalArray$okio[0];
|
|
int size2 = bytes.size();
|
|
long size3 = (size() - size2) + 1;
|
|
while (size < size3) {
|
|
byte[] bArr = segment.data;
|
|
int min = (int) Math.min(segment.limit, (segment.pos + size3) - size);
|
|
for (int i = (int) ((segment.pos + j) - size); i < min; i++) {
|
|
if (bArr[i] == b && BufferKt.rangeEquals(segment, i + 1, internalArray$okio, 1, size2)) {
|
|
return (i - segment.pos) + size;
|
|
}
|
|
}
|
|
size += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j = size;
|
|
}
|
|
}
|
|
} else {
|
|
while (true) {
|
|
long j3 = (segment.limit - segment.pos) + j2;
|
|
if (j3 > j) {
|
|
break;
|
|
}
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j2 = j3;
|
|
}
|
|
if (segment != null) {
|
|
byte[] internalArray$okio2 = bytes.internalArray$okio();
|
|
byte b2 = internalArray$okio2[0];
|
|
int size4 = bytes.size();
|
|
long size5 = (size() - size4) + 1;
|
|
while (j2 < size5) {
|
|
byte[] bArr2 = segment.data;
|
|
long j4 = j2;
|
|
int min2 = (int) Math.min(segment.limit, (segment.pos + size5) - j2);
|
|
for (int i2 = (int) ((segment.pos + j) - j4); i2 < min2; i2++) {
|
|
if (bArr2[i2] == b2 && BufferKt.rangeEquals(segment, i2 + 1, internalArray$okio2, 1, size4)) {
|
|
return (i2 - segment.pos) + j4;
|
|
}
|
|
}
|
|
j2 = j4 + (segment.limit - segment.pos);
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j = j2;
|
|
}
|
|
}
|
|
}
|
|
return -1L;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public long indexOfElement(ByteString targetBytes, long fromIndex) {
|
|
int i;
|
|
int i2;
|
|
Intrinsics.checkNotNullParameter(targetBytes, "targetBytes");
|
|
long j = 0;
|
|
if (!(fromIndex >= 0)) {
|
|
throw new IllegalArgumentException(("fromIndex < 0: " + fromIndex).toString());
|
|
}
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
if (size() - fromIndex < fromIndex) {
|
|
j = size();
|
|
while (j > fromIndex) {
|
|
segment = segment.prev;
|
|
Intrinsics.checkNotNull(segment);
|
|
j -= segment.limit - segment.pos;
|
|
}
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
if (targetBytes.size() == 2) {
|
|
byte b = targetBytes.getByte(0);
|
|
byte b2 = targetBytes.getByte(1);
|
|
while (j < size()) {
|
|
byte[] bArr = segment.data;
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
int i3 = segment.limit;
|
|
while (i < i3) {
|
|
byte b3 = bArr[i];
|
|
if (b3 != b && b3 != b2) {
|
|
i++;
|
|
}
|
|
i2 = segment.pos;
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
}
|
|
byte[] internalArray$okio = targetBytes.internalArray$okio();
|
|
while (j < size()) {
|
|
byte[] bArr2 = segment.data;
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
int i4 = segment.limit;
|
|
while (i < i4) {
|
|
byte b4 = bArr2[i];
|
|
for (byte b5 : internalArray$okio) {
|
|
if (b4 == b5) {
|
|
i2 = segment.pos;
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
}
|
|
while (true) {
|
|
long j2 = (segment.limit - segment.pos) + j;
|
|
if (j2 > fromIndex) {
|
|
break;
|
|
}
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
j = j2;
|
|
}
|
|
if (segment == null) {
|
|
return -1L;
|
|
}
|
|
if (targetBytes.size() == 2) {
|
|
byte b6 = targetBytes.getByte(0);
|
|
byte b7 = targetBytes.getByte(1);
|
|
while (j < size()) {
|
|
byte[] bArr3 = segment.data;
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
int i5 = segment.limit;
|
|
while (i < i5) {
|
|
byte b8 = bArr3[i];
|
|
if (b8 != b6 && b8 != b7) {
|
|
i++;
|
|
}
|
|
i2 = segment.pos;
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
}
|
|
byte[] internalArray$okio2 = targetBytes.internalArray$okio();
|
|
while (j < size()) {
|
|
byte[] bArr4 = segment.data;
|
|
i = (int) ((segment.pos + fromIndex) - j);
|
|
int i6 = segment.limit;
|
|
while (i < i6) {
|
|
byte b9 = bArr4[i];
|
|
for (byte b10 : internalArray$okio2) {
|
|
if (b9 == b10) {
|
|
i2 = segment.pos;
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
j += segment.limit - segment.pos;
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
fromIndex = j;
|
|
}
|
|
return -1L;
|
|
return (i - i2) + j;
|
|
}
|
|
|
|
@Override // okio.BufferedSource
|
|
public boolean rangeEquals(long offset, ByteString bytes, int bytesOffset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
|
if (offset < 0 || bytesOffset < 0 || byteCount < 0 || size() - offset < byteCount || bytes.size() - bytesOffset < byteCount) {
|
|
return false;
|
|
}
|
|
for (int i = 0; i < byteCount; i++) {
|
|
if (getByte(i + offset) != bytes.getByte(bytesOffset + i)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public boolean equals(Object other) {
|
|
if (this == other) {
|
|
return true;
|
|
}
|
|
if (other instanceof Buffer) {
|
|
Buffer buffer = (Buffer) other;
|
|
if (size() == buffer.size()) {
|
|
if (size() == 0) {
|
|
return true;
|
|
}
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment segment2 = buffer.head;
|
|
Intrinsics.checkNotNull(segment2);
|
|
int i = segment.pos;
|
|
int i2 = segment2.pos;
|
|
long j = 0;
|
|
while (j < size()) {
|
|
long min = Math.min(segment.limit - i, segment2.limit - i2);
|
|
long j2 = 0;
|
|
while (j2 < min) {
|
|
int i3 = i + 1;
|
|
int i4 = i2 + 1;
|
|
if (segment.data[i] == segment2.data[i2]) {
|
|
j2++;
|
|
i = i3;
|
|
i2 = i4;
|
|
}
|
|
}
|
|
if (i == segment.limit) {
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
i = segment.pos;
|
|
}
|
|
if (i2 == segment2.limit) {
|
|
segment2 = segment2.next;
|
|
Intrinsics.checkNotNull(segment2);
|
|
i2 = segment2.pos;
|
|
}
|
|
j += min;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Segment segment = this.head;
|
|
if (segment == null) {
|
|
return 0;
|
|
}
|
|
int i = 1;
|
|
do {
|
|
int i2 = segment.limit;
|
|
for (int i3 = segment.pos; i3 < i2; i3++) {
|
|
i = (i * 31) + segment.data[i3];
|
|
}
|
|
segment = segment.next;
|
|
Intrinsics.checkNotNull(segment);
|
|
} while (segment != this.head);
|
|
return i;
|
|
}
|
|
|
|
public final Buffer copy() {
|
|
Buffer buffer = new Buffer();
|
|
if (size() != 0) {
|
|
Segment segment = this.head;
|
|
Intrinsics.checkNotNull(segment);
|
|
Segment sharedCopy = segment.sharedCopy();
|
|
buffer.head = sharedCopy;
|
|
sharedCopy.prev = sharedCopy;
|
|
sharedCopy.next = sharedCopy.prev;
|
|
for (Segment segment2 = segment.next; segment2 != segment; segment2 = segment2.next) {
|
|
Segment segment3 = sharedCopy.prev;
|
|
Intrinsics.checkNotNull(segment3);
|
|
Intrinsics.checkNotNull(segment2);
|
|
segment3.push(segment2.sharedCopy());
|
|
}
|
|
buffer.setSize$okio(size());
|
|
}
|
|
return buffer;
|
|
}
|
|
|
|
public final ByteString snapshot() {
|
|
if (!(size() <= ((long) Integer.MAX_VALUE))) {
|
|
throw new IllegalStateException(("size > Int.MAX_VALUE: " + size()).toString());
|
|
}
|
|
return snapshot((int) size());
|
|
}
|
|
|
|
public final ByteString snapshot(int byteCount) {
|
|
if (byteCount == 0) {
|
|
return ByteString.EMPTY;
|
|
}
|
|
Util.checkOffsetAndCount(size(), 0L, byteCount);
|
|
Segment segment = this.head;
|
|
int i = 0;
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
while (i2 < byteCount) {
|
|
Intrinsics.checkNotNull(segment);
|
|
if (segment.limit == segment.pos) {
|
|
throw new AssertionError("s.limit == s.pos");
|
|
}
|
|
i2 += segment.limit - segment.pos;
|
|
i3++;
|
|
segment = segment.next;
|
|
}
|
|
byte[][] bArr = new byte[i3];
|
|
int[] iArr = new int[i3 * 2];
|
|
Segment segment2 = this.head;
|
|
int i4 = 0;
|
|
while (i < byteCount) {
|
|
Intrinsics.checkNotNull(segment2);
|
|
bArr[i4] = segment2.data;
|
|
i += segment2.limit - segment2.pos;
|
|
iArr[i4] = Math.min(i, byteCount);
|
|
iArr[bArr.length + i4] = segment2.pos;
|
|
segment2.shared = true;
|
|
i4++;
|
|
segment2 = segment2.next;
|
|
}
|
|
return new SegmentedByteString(bArr, iArr);
|
|
}
|
|
}
|