123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- .class Lokhttp3/internal/cache2/Relay$RelaySource;
- .super Ljava/lang/Object;
- .source ""
- # interfaces
- .implements Lokio/Source;
- # annotations
- .annotation system Ldalvik/annotation/EnclosingClass;
- value = Lokhttp3/internal/cache2/Relay;
- .end annotation
- .annotation system Ldalvik/annotation/InnerClass;
- accessFlags = 0x0
- name = "RelaySource"
- .end annotation
- # instance fields
- .field private fileOperator:Lokhttp3/internal/cache2/FileOperator;
- .field private sourcePos:J
- .field final synthetic this$0:Lokhttp3/internal/cache2/Relay;
- .field private final timeout:Lokio/Timeout;
- # direct methods
- .method constructor <init>(Lokhttp3/internal/cache2/Relay;)V
- .locals 1
- iput-object p1, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- new-instance p1, Lokio/Timeout;
- invoke-direct {p1}, Lokio/Timeout;-><init>()V
- iput-object p1, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->timeout:Lokio/Timeout;
- new-instance p1, Lokhttp3/internal/cache2/FileOperator;
- iget-object v0, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile;
- invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
- move-result-object v0
- invoke-direct {p1, v0}, Lokhttp3/internal/cache2/FileOperator;-><init>(Ljava/nio/channels/FileChannel;)V
- iput-object p1, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- return-void
- .end method
- # virtual methods
- .method public close()V
- .locals 4
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- if-nez v0, :cond_0
- return-void
- :cond_0
- const/4 v0, 0x0
- iput-object v0, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- iget-object v1, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v1
- :try_start_0
- iget-object v2, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget v3, v2, Lokhttp3/internal/cache2/Relay;->sourceCount:I
- add-int/lit8 v3, v3, -0x1
- iput v3, v2, Lokhttp3/internal/cache2/Relay;->sourceCount:I
- iget-object v2, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget v2, v2, Lokhttp3/internal/cache2/Relay;->sourceCount:I
- if-nez v2, :cond_1
- iget-object v2, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v2, v2, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile;
- iget-object v3, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iput-object v0, v3, Lokhttp3/internal/cache2/Relay;->file:Ljava/io/RandomAccessFile;
- move-object v0, v2
- :cond_1
- monitor-exit v1
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- if-eqz v0, :cond_2
- invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
- :cond_2
- return-void
- :catchall_0
- move-exception v0
- :try_start_1
- monitor-exit v1
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- throw v0
- .end method
- .method public read(Lokio/Buffer;J)J
- .locals 21
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- move-object/from16 v1, p0
- move-wide/from16 v2, p2
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- if-eqz v0, :cond_7
- iget-object v4, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v4
- :goto_0
- :try_start_0
- iget-wide v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-wide v7, v0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J
- const/4 v0, 0x2
- const-wide/16 v9, -0x1
- cmp-long v11, v5, v7
- if-nez v11, :cond_2
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-boolean v5, v5, Lokhttp3/internal/cache2/Relay;->complete:Z
- if-eqz v5, :cond_0
- monitor-exit v4
- return-wide v9
- :cond_0
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v5, v5, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread;
- if-eqz v5, :cond_1
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->timeout:Lokio/Timeout;
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-virtual {v0, v5}, Lokio/Timeout;->waitUntilNotified(Ljava/lang/Object;)V
- goto :goto_0
- :cond_1
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
- move-result-object v6
- iput-object v6, v5, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread;
- const/4 v5, 0x1
- monitor-exit v4
- goto :goto_1
- :cond_2
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v5, v5, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- invoke-virtual {v5}, Lokio/Buffer;->size()J
- move-result-wide v5
- sub-long v5, v7, v5
- iget-wide v11, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- cmp-long v13, v11, v5
- if-gez v13, :cond_6
- monitor-exit v4
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_5
- const/4 v5, 0x2
- :goto_1
- const-wide/16 v11, 0x20
- if-ne v5, v0, :cond_3
- iget-wide v4, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- sub-long/2addr v7, v4
- invoke-static {v2, v3, v7, v8}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v2
- iget-object v13, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- iget-wide v4, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- add-long v14, v4, v11
- move-object/from16 v16, p1
- move-wide/from16 v17, v2
- invoke-virtual/range {v13 .. v18}, Lokhttp3/internal/cache2/FileOperator;->read(JLokio/Buffer;J)V
- iget-wide v4, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- add-long/2addr v4, v2
- iput-wide v4, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- return-wide v2
- :cond_3
- const/4 v4, 0x0
- :try_start_1
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->upstream:Lokio/Source;
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v5, v5, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer;
- iget-object v6, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-wide v13, v6, Lokhttp3/internal/cache2/Relay;->bufferMaxSize:J
- invoke-interface {v0, v5, v13, v14}, Lokio/Source;->read(Lokio/Buffer;J)J
- move-result-wide v5
- cmp-long v0, v5, v9
- if-nez v0, :cond_4
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-virtual {v0, v7, v8}, Lokhttp3/internal/cache2/Relay;->commit(J)V
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_3
- iget-object v2, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v2
- :try_start_2
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iput-object v4, v0, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread;
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V
- monitor-exit v2
- return-wide v9
- :catchall_0
- move-exception v0
- monitor-exit v2
- :try_end_2
- .catchall {:try_start_2 .. :try_end_2} :catchall_0
- throw v0
- :cond_4
- :try_start_3
- invoke-static {v5, v6, v2, v3}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v2
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v13, v0, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer;
- const-wide/16 v15, 0x0
- move-object/from16 v14, p1
- move-wide/from16 v17, v2
- invoke-virtual/range {v13 .. v18}, Lokio/Buffer;->copyTo(Lokio/Buffer;JJ)Lokio/Buffer;
- iget-wide v9, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- add-long/2addr v9, v2
- iput-wide v9, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- iget-object v15, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->fileOperator:Lokhttp3/internal/cache2/FileOperator;
- add-long v16, v7, v11
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer;
- invoke-virtual {v0}, Lokio/Buffer;->clone()Lokio/Buffer;
- move-result-object v18
- move-wide/from16 v19, v5
- invoke-virtual/range {v15 .. v20}, Lokhttp3/internal/cache2/FileOperator;->write(JLokio/Buffer;J)V
- iget-object v7, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v7
- :try_end_3
- .catchall {:try_start_3 .. :try_end_3} :catchall_3
- :try_start_4
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- iget-object v8, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v8, v8, Lokhttp3/internal/cache2/Relay;->upstreamBuffer:Lokio/Buffer;
- invoke-virtual {v0, v8, v5, v6}, Lokio/Buffer;->write(Lokio/Buffer;J)V
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- invoke-virtual {v0}, Lokio/Buffer;->size()J
- move-result-wide v8
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-wide v10, v0, Lokhttp3/internal/cache2/Relay;->bufferMaxSize:J
- cmp-long v0, v8, v10
- if-lez v0, :cond_5
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v0, v0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- iget-object v8, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v8, v8, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- invoke-virtual {v8}, Lokio/Buffer;->size()J
- move-result-wide v8
- iget-object v10, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-wide v10, v10, Lokhttp3/internal/cache2/Relay;->bufferMaxSize:J
- sub-long/2addr v8, v10
- invoke-virtual {v0, v8, v9}, Lokio/Buffer;->skip(J)V
- :cond_5
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-wide v8, v0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J
- add-long/2addr v8, v5
- iput-wide v8, v0, Lokhttp3/internal/cache2/Relay;->upstreamPos:J
- monitor-exit v7
- :try_end_4
- .catchall {:try_start_4 .. :try_end_4} :catchall_2
- iget-object v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v5
- :try_start_5
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iput-object v4, v0, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread;
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V
- monitor-exit v5
- return-wide v2
- :catchall_1
- move-exception v0
- monitor-exit v5
- :try_end_5
- .catchall {:try_start_5 .. :try_end_5} :catchall_1
- throw v0
- :catchall_2
- move-exception v0
- :try_start_6
- monitor-exit v7
- :try_end_6
- .catchall {:try_start_6 .. :try_end_6} :catchall_2
- :try_start_7
- throw v0
- :try_end_7
- .catchall {:try_start_7 .. :try_end_7} :catchall_3
- :catchall_3
- move-exception v0
- iget-object v2, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- monitor-enter v2
- :try_start_8
- iget-object v3, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iput-object v4, v3, Lokhttp3/internal/cache2/Relay;->upstreamReader:Ljava/lang/Thread;
- iget-object v3, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- invoke-virtual {v3}, Ljava/lang/Object;->notifyAll()V
- monitor-exit v2
- :try_end_8
- .catchall {:try_start_8 .. :try_end_8} :catchall_4
- throw v0
- :catchall_4
- move-exception v0
- :try_start_9
- monitor-exit v2
- :try_end_9
- .catchall {:try_start_9 .. :try_end_9} :catchall_4
- throw v0
- :cond_6
- :try_start_a
- iget-wide v9, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- sub-long/2addr v7, v9
- invoke-static {v2, v3, v7, v8}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v2
- iget-object v0, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->this$0:Lokhttp3/internal/cache2/Relay;
- iget-object v9, v0, Lokhttp3/internal/cache2/Relay;->buffer:Lokio/Buffer;
- iget-wide v7, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- sub-long v11, v7, v5
- move-object/from16 v10, p1
- move-wide v13, v2
- invoke-virtual/range {v9 .. v14}, Lokio/Buffer;->copyTo(Lokio/Buffer;JJ)Lokio/Buffer;
- iget-wide v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- add-long/2addr v5, v2
- iput-wide v5, v1, Lokhttp3/internal/cache2/Relay$RelaySource;->sourcePos:J
- monitor-exit v4
- return-wide v2
- :catchall_5
- move-exception v0
- monitor-exit v4
- :try_end_a
- .catchall {:try_start_a .. :try_end_a} :catchall_5
- throw v0
- :cond_7
- new-instance v0, Ljava/lang/IllegalStateException;
- const-string v2, "closed"
- invoke-direct {v0, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- goto :goto_3
- :goto_2
- throw v0
- :goto_3
- goto :goto_2
- .end method
- .method public timeout()Lokio/Timeout;
- .locals 1
- iget-object v0, p0, Lokhttp3/internal/cache2/Relay$RelaySource;->timeout:Lokio/Timeout;
- return-object v0
- .end method
|