.class public final Lokhttp3/internal/cache2/Relay; .super Ljava/lang/Object; .source "Relay.kt" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lokhttp3/internal/cache2/Relay$RelaySource;, Lokhttp3/internal/cache2/Relay$Companion; } .end annotation .annotation runtime Lkotlin/Metadata; bv = { 0x1, 0x0, 0x3 } d1 = { "\u0000L\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0010\u000b\n\u0002\u0008\n\n\u0002\u0010\u0008\n\u0002\u0008\u000e\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0010\u0002\n\u0002\u0008\t\u0018\u0000 :2\u00020\u0001:\u0002:;B3\u0008\u0002\u0012\u0008\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0008\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\u0008\u001a\u00020\t\u0012\u0006\u0010\n\u001a\u00020\u0007\u00a2\u0006\u0002\u0010\u000bJ\u000e\u00102\u001a\u0002032\u0006\u00104\u001a\u00020\u0007J\u0006\u0010\u0008\u001a\u00020\tJ\u0008\u00105\u001a\u0004\u0018\u00010\u0005J \u00106\u001a\u0002032\u0006\u00107\u001a\u00020\t2\u0006\u00104\u001a\u00020\u00072\u0006\u00108\u001a\u00020\u0007H\u0002J\u0010\u00109\u001a\u0002032\u0006\u00104\u001a\u00020\u0007H\u0002R\u0011\u0010\u000c\u001a\u00020\r\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\u000e\u0010\u000fR\u0011\u0010\n\u001a\u00020\u0007\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u0014\u0010\u0015\"\u0004\u0008\u0016\u0010\u0017R\u001c\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u0018\u0010\u0019\"\u0004\u0008\u001a\u0010\u001bR\u0011\u0010\u001c\u001a\u00020\u00138F\u00a2\u0006\u0006\u001a\u0004\u0008\u001c\u0010\u0015R\u000e\u0010\u0008\u001a\u00020\tX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u001a\u0010\u001d\u001a\u00020\u001eX\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u001f\u0010 \"\u0004\u0008!\u0010\"R\u001c\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008#\u0010$\"\u0004\u0008%\u0010&R\u0011\u0010\'\u001a\u00020\r\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008(\u0010\u000fR\u001a\u0010\u0006\u001a\u00020\u0007X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008)\u0010\u0011\"\u0004\u0008*\u0010+R\u001c\u0010,\u001a\u0004\u0018\u00010-X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008.\u0010/\"\u0004\u00080\u00101\u00a8\u0006<" } d2 = { "Lokhttp3/internal/cache2/Relay;", "", "file", "Ljava/io/RandomAccessFile;", "upstream", "Lokio/Source;", "upstreamPos", "", "metadata", "Lokio/ByteString;", "bufferMaxSize", "(Ljava/io/RandomAccessFile;Lokio/Source;JLokio/ByteString;J)V", "buffer", "Lokio/Buffer;", "getBuffer", "()Lokio/Buffer;", "getBufferMaxSize", "()J", "complete", "", "getComplete", "()Z", "setComplete", "(Z)V", "getFile", "()Ljava/io/RandomAccessFile;", "setFile", "(Ljava/io/RandomAccessFile;)V", "isClosed", "sourceCount", "", "getSourceCount", "()I", "setSourceCount", "(I)V", "getUpstream", "()Lokio/Source;", "setUpstream", "(Lokio/Source;)V", "upstreamBuffer", "getUpstreamBuffer", "getUpstreamPos", "setUpstreamPos", "(J)V", "upstreamReader", "Ljava/lang/Thread;", "getUpstreamReader", "()Ljava/lang/Thread;", "setUpstreamReader", "(Ljava/lang/Thread;)V", "commit", "", "upstreamSize", "newSource", "writeHeader", "prefix", "metadataSize", "writeMetadata", "Companion", "RelaySource", "okhttp" } k = 0x1 mv = { 0x1, 0x4, 0x0 } .end annotation # static fields .field public static final Companion:Lokhttp3/internal/cache2/Relay$Companion; .field private static final FILE_HEADER_SIZE:J = 0x20L .field public static final PREFIX_CLEAN:Lokio/ByteString; .field public static final PREFIX_DIRTY:Lokio/ByteString; .field private static final SOURCE_FILE:I = 0x2 .field private static final SOURCE_UPSTREAM:I = 0x1 # instance fields .field private final buffer:Lokio/Buffer; .field private final bufferMaxSize:J .field private complete:Z .field private file:Ljava/io/RandomAccessFile; .field private final metadata:Lokio/ByteString; .field private sourceCount:I .field private upstream:Lokio/Source; .field private final upstreamBuffer:Lokio/Buffer; .field private upstreamPos:J .field private upstreamReader:Ljava/lang/Thread; # direct methods .method static constructor ()V .locals 2 new-instance v0, Lokhttp3/internal/cache2/Relay$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Lokhttp3/internal/cache2/Relay$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Lokhttp3/internal/cache2/Relay;->Companion:Lokhttp3/internal/cache2/Relay$Companion; .line 299 sget-object v0, Lokio/ByteString;->Companion:Lokio/ByteString$Companion; const-string v1, "OkHttp cache v1\n" invoke-virtual {v0, v1}, Lokio/ByteString$Companion;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString; move-result-object v0 sput-object v0, Lokhttp3/internal/cache2/Relay;->PREFIX_CLEAN:Lokio/ByteString; .line 300 sget-object v0, Lokio/ByteString;->Companion:Lokio/ByteString$Companion; const-string v1, "OkHttp DIRTY :(\n" invoke-virtual {v0, v1}, Lokio/ByteString$Companion;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString; move-result-object v0 sput-object v0, Lokhttp3/internal/cache2/Relay;->PREFIX_DIRTY:Lokio/ByteString; return-void .end method .method private constructor (Ljava/io/RandomAccessFile;Lokio/Source;JLokio/ByteString;J)V .locals 0 .line 40 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; iput-object p2, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; iput-wide p3, p0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J iput-object p5, p0, Lokhttp3/internal/cache2/Relay;->metadata:Lokio/ByteString; iput-wide p6, p0, Lokhttp3/internal/cache2/Relay;->bufferMaxSize:J .line 78 new-instance p1, Lokio/Buffer; invoke-direct {p1}, Lokio/Buffer;->()V iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer; iget-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; if-nez p1, :cond_0 const/4 p1, 0x1 goto :goto_0 :cond_0 const/4 p1, 0x0 :goto_0 iput-boolean p1, p0, Lokhttp3/internal/cache2/Relay;->complete:Z .line 84 new-instance p1, Lokio/Buffer; invoke-direct {p1}, Lokio/Buffer;->()V iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer; return-void .end method .method public synthetic constructor (Ljava/io/RandomAccessFile;Lokio/Source;JLokio/ByteString;JLkotlin/jvm/internal/DefaultConstructorMarker;)V .locals 0 .line 40 invoke-direct/range {p0 .. p7}, Lokhttp3/internal/cache2/Relay;->(Ljava/io/RandomAccessFile;Lokio/Source;JLokio/ByteString;J)V return-void .end method .method public static final synthetic access$writeHeader(Lokhttp3/internal/cache2/Relay;Lokio/ByteString;JJ)V .locals 0 .line 40 invoke-direct/range {p0 .. p5}, Lokhttp3/internal/cache2/Relay;->writeHeader(Lokio/ByteString;JJ)V return-void .end method .method private final writeHeader(Lokio/ByteString;JJ)V .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 101 new-instance v0, Lokio/Buffer; invoke-direct {v0}, Lokio/Buffer;->()V .line 102 invoke-virtual {v0, p1}, Lokio/Buffer;->write(Lokio/ByteString;)Lokio/Buffer; .line 103 invoke-virtual {v0, p2, p3}, Lokio/Buffer;->writeLong(J)Lokio/Buffer; .line 104 invoke-virtual {v0, p4, p5}, Lokio/Buffer;->writeLong(J)Lokio/Buffer; .line 105 invoke-virtual {v0}, Lokio/Buffer;->size()J move-result-wide p1 const-wide/16 p3, 0x20 cmp-long p1, p1, p3 if-nez p1, :cond_0 const/4 p1, 0x1 goto :goto_0 :cond_0 const/4 p1, 0x0 :goto_0 if-eqz p1, :cond_1 .line 108 new-instance p1, Lokhttp3/internal/cache2/FileOperator; iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; invoke-static {p0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {p0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel; move-result-object p0 const-string p2, "file!!.channel" invoke-static {p0, p2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-direct {p1, p0}, Lokhttp3/internal/cache2/FileOperator;->(Ljava/nio/channels/FileChannel;)V const-wide/16 p2, 0x0 const-wide/16 p4, 0x20 move-object p0, p1 move-wide p1, p2 move-object p3, v0 .line 109 invoke-virtual/range {p0 .. p5}, Lokhttp3/internal/cache2/FileOperator;->write(JLokio/Buffer;J)V return-void .line 105 :cond_1 new-instance p0, Ljava/lang/IllegalArgumentException; const-string p1, "Failed requirement." invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V check-cast p0, Ljava/lang/Throwable; throw p0 .end method .method private final writeMetadata(J)V .locals 6 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 114 new-instance v3, Lokio/Buffer; invoke-direct {v3}, Lokio/Buffer;->()V iget-object v0, p0, Lokhttp3/internal/cache2/Relay;->metadata:Lokio/ByteString; .line 115 invoke-virtual {v3, v0}, Lokio/Buffer;->write(Lokio/ByteString;)Lokio/Buffer; .line 117 new-instance v0, Lokhttp3/internal/cache2/FileOperator; iget-object v1, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; invoke-static {v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v1}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel; move-result-object v1 const-string v2, "file!!.channel" invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-direct {v0, v1}, Lokhttp3/internal/cache2/FileOperator;->(Ljava/nio/channels/FileChannel;)V const-wide/16 v1, 0x20 add-long/2addr v1, p1 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->metadata:Lokio/ByteString; .line 118 invoke-virtual {p0}, Lokio/ByteString;->size()I move-result p0 int-to-long v4, p0 invoke-virtual/range {v0 .. v5}, Lokhttp3/internal/cache2/FileOperator;->write(JLokio/Buffer;J)V return-void .end method # virtual methods .method public final commit(J)V .locals 8 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 124 invoke-direct {p0, p1, p2}, Lokhttp3/internal/cache2/Relay;->writeMetadata(J)V iget-object v0, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; .line 125 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel; move-result-object v0 const/4 v1, 0x0 invoke-virtual {v0, v1}, Ljava/nio/channels/FileChannel;->force(Z)V sget-object v3, Lokhttp3/internal/cache2/Relay;->PREFIX_CLEAN:Lokio/ByteString; iget-object v0, p0, Lokhttp3/internal/cache2/Relay;->metadata:Lokio/ByteString; .line 128 invoke-virtual {v0}, Lokio/ByteString;->size()I move-result v0 int-to-long v6, v0 move-object v2, p0 move-wide v4, p1 invoke-direct/range {v2 .. v7}, Lokhttp3/internal/cache2/Relay;->writeHeader(Lokio/ByteString;JJ)V iget-object p1, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; .line 129 invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V invoke-virtual {p1}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel; move-result-object p1 invoke-virtual {p1, v1}, Ljava/nio/channels/FileChannel;->force(Z)V .line 132 monitor-enter p0 const/4 p1, 0x1 :try_start_0 iput-boolean p1, p0, Lokhttp3/internal/cache2/Relay;->complete:Z .line 134 sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 132 monitor-exit p0 iget-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; if-eqz p1, :cond_0 .line 136 check-cast p1, Ljava/io/Closeable; invoke-static {p1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V :cond_0 const/4 p1, 0x0 .line 137 move-object p2, p1 check-cast p2, Lokio/Source; iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; return-void :catchall_0 move-exception p1 .line 132 monitor-exit p0 throw p1 .end method .method public final getBuffer()Lokio/Buffer; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer; return-object p0 .end method .method public final getBufferMaxSize()J .locals 2 iget-wide v0, p0, Lokhttp3/internal/cache2/Relay;->bufferMaxSize:J return-wide v0 .end method .method public final getComplete()Z .locals 0 iget-boolean p0, p0, Lokhttp3/internal/cache2/Relay;->complete:Z return p0 .end method .method public final getFile()Ljava/io/RandomAccessFile; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; return-object p0 .end method .method public final getSourceCount()I .locals 0 iget p0, p0, Lokhttp3/internal/cache2/Relay;->sourceCount:I return p0 .end method .method public final getUpstream()Lokio/Source; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; return-object p0 .end method .method public final getUpstreamBuffer()Lokio/Buffer; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer; return-object p0 .end method .method public final getUpstreamPos()J .locals 2 iget-wide v0, p0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J return-wide v0 .end method .method public final getUpstreamReader()Ljava/lang/Thread; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread; return-object p0 .end method .method public final isClosed()Z .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; if-nez p0, :cond_0 const/4 p0, 0x1 goto :goto_0 :cond_0 const/4 p0, 0x0 :goto_0 return p0 .end method .method public final metadata()Lokio/ByteString; .locals 0 iget-object p0, p0, Lokhttp3/internal/cache2/Relay;->metadata:Lokio/ByteString; return-object p0 .end method .method public final newSource()Lokio/Source; .locals 1 .line 148 monitor-enter p0 :try_start_0 iget-object v0, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 if-nez v0, :cond_0 .line 149 monitor-exit p0 const/4 p0, 0x0 return-object p0 :cond_0 :try_start_1 iget v0, p0, Lokhttp3/internal/cache2/Relay;->sourceCount:I add-int/lit8 v0, v0, 0x1 iput v0, p0, Lokhttp3/internal/cache2/Relay;->sourceCount:I :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 148 monitor-exit p0 .line 153 new-instance v0, Lokhttp3/internal/cache2/Relay$RelaySource; invoke-direct {v0, p0}, Lokhttp3/internal/cache2/Relay$RelaySource;->(Lokhttp3/internal/cache2/Relay;)V check-cast v0, Lokio/Source; return-object v0 :catchall_0 move-exception v0 .line 148 monitor-exit p0 throw v0 .end method .method public final setComplete(Z)V .locals 0 iput-boolean p1, p0, Lokhttp3/internal/cache2/Relay;->complete:Z return-void .end method .method public final setFile(Ljava/io/RandomAccessFile;)V .locals 0 iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile; return-void .end method .method public final setSourceCount(I)V .locals 0 iput p1, p0, Lokhttp3/internal/cache2/Relay;->sourceCount:I return-void .end method .method public final setUpstream(Lokio/Source;)V .locals 0 iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source; return-void .end method .method public final setUpstreamPos(J)V .locals 0 iput-wide p1, p0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J return-void .end method .method public final setUpstreamReader(Ljava/lang/Thread;)V .locals 0 iput-object p1, p0, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread; return-void .end method