CacheInterceptor$1.smali 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. .class Lokhttp3/internal/cache/CacheInterceptor$1;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokio/Source;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingMethod;
  8. value = Lokhttp3/internal/cache/CacheInterceptor;->cacheWritingResponse(Lokhttp3/internal/cache/CacheRequest;Lokhttp3/Response;)Lokhttp3/Response;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x0
  12. name = null
  13. .end annotation
  14. # instance fields
  15. .field cacheRequestClosed:Z
  16. .field final synthetic this$0:Lokhttp3/internal/cache/CacheInterceptor;
  17. .field final synthetic val$cacheBody:Lokio/BufferedSink;
  18. .field final synthetic val$cacheRequest:Lokhttp3/internal/cache/CacheRequest;
  19. .field final synthetic val$source:Lokio/BufferedSource;
  20. # direct methods
  21. .method constructor <init>(Lokhttp3/internal/cache/CacheInterceptor;Lokio/BufferedSource;Lokhttp3/internal/cache/CacheRequest;Lokio/BufferedSink;)V
  22. .locals 0
  23. iput-object p1, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->this$0:Lokhttp3/internal/cache/CacheInterceptor;
  24. iput-object p2, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$source:Lokio/BufferedSource;
  25. iput-object p3, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheRequest:Lokhttp3/internal/cache/CacheRequest;
  26. iput-object p4, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheBody:Lokio/BufferedSink;
  27. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  28. return-void
  29. .end method
  30. # virtual methods
  31. .method public close()V
  32. .locals 2
  33. .annotation system Ldalvik/annotation/Throws;
  34. value = {
  35. Ljava/io/IOException;
  36. }
  37. .end annotation
  38. iget-boolean v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  39. if-nez v0, :cond_0
  40. const/16 v0, 0x64
  41. sget-object v1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  42. invoke-static {p0, v0, v1}, Lokhttp3/internal/Util;->discard(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
  43. move-result v0
  44. if-nez v0, :cond_0
  45. const/4 v0, 0x1
  46. iput-boolean v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  47. iget-object v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheRequest:Lokhttp3/internal/cache/CacheRequest;
  48. invoke-interface {v0}, Lokhttp3/internal/cache/CacheRequest;->abort()V
  49. :cond_0
  50. iget-object v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$source:Lokio/BufferedSource;
  51. invoke-interface {v0}, Lokio/Source;->close()V
  52. return-void
  53. .end method
  54. .method public read(Lokio/Buffer;J)J
  55. .locals 8
  56. .annotation system Ldalvik/annotation/Throws;
  57. value = {
  58. Ljava/io/IOException;
  59. }
  60. .end annotation
  61. const/4 v0, 0x1
  62. :try_start_0
  63. iget-object v1, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$source:Lokio/BufferedSource;
  64. invoke-interface {v1, p1, p2, p3}, Lokio/Source;->read(Lokio/Buffer;J)J
  65. move-result-wide p2
  66. :try_end_0
  67. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  68. const-wide/16 v1, -0x1
  69. cmp-long v3, p2, v1
  70. if-nez v3, :cond_1
  71. iget-boolean p1, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  72. if-nez p1, :cond_0
  73. iput-boolean v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  74. iget-object p1, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheBody:Lokio/BufferedSink;
  75. invoke-interface {p1}, Lokio/Sink;->close()V
  76. :cond_0
  77. return-wide v1
  78. :cond_1
  79. iget-object v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheBody:Lokio/BufferedSink;
  80. invoke-interface {v0}, Lokio/BufferedSink;->buffer()Lokio/Buffer;
  81. move-result-object v3
  82. invoke-virtual {p1}, Lokio/Buffer;->size()J
  83. move-result-wide v0
  84. sub-long v4, v0, p2
  85. move-object v2, p1
  86. move-wide v6, p2
  87. invoke-virtual/range {v2 .. v7}, Lokio/Buffer;->copyTo(Lokio/Buffer;JJ)Lokio/Buffer;
  88. iget-object p1, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheBody:Lokio/BufferedSink;
  89. invoke-interface {p1}, Lokio/BufferedSink;->emitCompleteSegments()Lokio/BufferedSink;
  90. return-wide p2
  91. :catch_0
  92. move-exception p1
  93. iget-boolean p2, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  94. if-nez p2, :cond_2
  95. iput-boolean v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->cacheRequestClosed:Z
  96. iget-object p2, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$cacheRequest:Lokhttp3/internal/cache/CacheRequest;
  97. invoke-interface {p2}, Lokhttp3/internal/cache/CacheRequest;->abort()V
  98. :cond_2
  99. throw p1
  100. .end method
  101. .method public timeout()Lokio/Timeout;
  102. .locals 1
  103. iget-object v0, p0, Lokhttp3/internal/cache/CacheInterceptor$1;->val$source:Lokio/BufferedSource;
  104. invoke-interface {v0}, Lokio/Source;->timeout()Lokio/Timeout;
  105. move-result-object v0
  106. return-object v0
  107. .end method