DiskLruCache$Entry.smali 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. .class final Lokhttp3/internal/cache/DiskLruCache$Entry;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/EnclosingClass;
  6. value = Lokhttp3/internal/cache/DiskLruCache;
  7. .end annotation
  8. .annotation system Ldalvik/annotation/InnerClass;
  9. accessFlags = 0x12
  10. name = "Entry"
  11. .end annotation
  12. # instance fields
  13. .field final cleanFiles:[Ljava/io/File;
  14. .field currentEditor:Lokhttp3/internal/cache/DiskLruCache$Editor;
  15. .field final dirtyFiles:[Ljava/io/File;
  16. .field final key:Ljava/lang/String;
  17. .field final lengths:[J
  18. .field readable:Z
  19. .field sequenceNumber:J
  20. .field final synthetic this$0:Lokhttp3/internal/cache/DiskLruCache;
  21. # direct methods
  22. .method constructor <init>(Lokhttp3/internal/cache/DiskLruCache;Ljava/lang/String;)V
  23. .locals 6
  24. iput-object p1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  25. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  26. iput-object p2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->key:Ljava/lang/String;
  27. iget v0, p1, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  28. new-array v1, v0, [J
  29. iput-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->lengths:[J
  30. new-array v1, v0, [Ljava/io/File;
  31. iput-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->cleanFiles:[Ljava/io/File;
  32. new-array v0, v0, [Ljava/io/File;
  33. iput-object v0, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->dirtyFiles:[Ljava/io/File;
  34. new-instance v0, Ljava/lang/StringBuilder;
  35. invoke-direct {v0, p2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
  36. const/16 p2, 0x2e
  37. invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  38. invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
  39. move-result p2
  40. const/4 v1, 0x0
  41. :goto_0
  42. iget v2, p1, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  43. if-ge v1, v2, :cond_0
  44. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  45. iget-object v2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->cleanFiles:[Ljava/io/File;
  46. new-instance v3, Ljava/io/File;
  47. iget-object v4, p1, Lokhttp3/internal/cache/DiskLruCache;->directory:Ljava/io/File;
  48. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  49. move-result-object v5
  50. invoke-direct {v3, v4, v5}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
  51. aput-object v3, v2, v1
  52. const-string v2, ".tmp"
  53. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  54. iget-object v2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->dirtyFiles:[Ljava/io/File;
  55. new-instance v3, Ljava/io/File;
  56. iget-object v4, p1, Lokhttp3/internal/cache/DiskLruCache;->directory:Ljava/io/File;
  57. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  58. move-result-object v5
  59. invoke-direct {v3, v4, v5}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
  60. aput-object v3, v2, v1
  61. invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->setLength(I)V
  62. add-int/lit8 v1, v1, 0x1
  63. goto :goto_0
  64. :cond_0
  65. return-void
  66. .end method
  67. .method private invalidLengths([Ljava/lang/String;)Ljava/io/IOException;
  68. .locals 3
  69. .annotation system Ldalvik/annotation/Throws;
  70. value = {
  71. Ljava/io/IOException;
  72. }
  73. .end annotation
  74. new-instance v0, Ljava/io/IOException;
  75. new-instance v1, Ljava/lang/StringBuilder;
  76. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  77. const-string v2, "unexpected journal line: "
  78. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  79. invoke-static {p1}, Ljava/util/Arrays;->toString([Ljava/lang/Object;)Ljava/lang/String;
  80. move-result-object p1
  81. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  82. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  83. move-result-object p1
  84. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  85. throw v0
  86. .end method
  87. # virtual methods
  88. .method setLengths([Ljava/lang/String;)V
  89. .locals 4
  90. .annotation system Ldalvik/annotation/Throws;
  91. value = {
  92. Ljava/io/IOException;
  93. }
  94. .end annotation
  95. array-length v0, p1
  96. iget-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  97. iget v1, v1, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  98. if-ne v0, v1, :cond_1
  99. const/4 v0, 0x0
  100. :goto_0
  101. :try_start_0
  102. array-length v1, p1
  103. if-ge v0, v1, :cond_0
  104. iget-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->lengths:[J
  105. aget-object v2, p1, v0
  106. invoke-static {v2}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
  107. move-result-wide v2
  108. aput-wide v2, v1, v0
  109. :try_end_0
  110. .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
  111. add-int/lit8 v0, v0, 0x1
  112. goto :goto_0
  113. :cond_0
  114. return-void
  115. :catch_0
  116. invoke-direct {p0, p1}, Lokhttp3/internal/cache/DiskLruCache$Entry;->invalidLengths([Ljava/lang/String;)Ljava/io/IOException;
  117. move-result-object p1
  118. throw p1
  119. :cond_1
  120. invoke-direct {p0, p1}, Lokhttp3/internal/cache/DiskLruCache$Entry;->invalidLengths([Ljava/lang/String;)Ljava/io/IOException;
  121. move-result-object p1
  122. goto :goto_2
  123. :goto_1
  124. throw p1
  125. :goto_2
  126. goto :goto_1
  127. .end method
  128. .method snapshot()Lokhttp3/internal/cache/DiskLruCache$Snapshot;
  129. .locals 10
  130. iget-object v0, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  131. invoke-static {v0}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z
  132. move-result v0
  133. if-eqz v0, :cond_2
  134. iget-object v0, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  135. iget v0, v0, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  136. new-array v0, v0, [Lokio/Source;
  137. iget-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->lengths:[J
  138. invoke-virtual {v1}, [J->clone()Ljava/lang/Object;
  139. move-result-object v1
  140. move-object v7, v1
  141. check-cast v7, [J
  142. const/4 v8, 0x0
  143. const/4 v1, 0x0
  144. :goto_0
  145. :try_start_0
  146. iget-object v2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  147. iget v2, v2, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  148. if-ge v1, v2, :cond_0
  149. iget-object v2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  150. iget-object v2, v2, Lokhttp3/internal/cache/DiskLruCache;->fileSystem:Lokhttp3/internal/io/FileSystem;
  151. iget-object v3, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->cleanFiles:[Ljava/io/File;
  152. aget-object v3, v3, v1
  153. invoke-interface {v2, v3}, Lokhttp3/internal/io/FileSystem;->source(Ljava/io/File;)Lokio/Source;
  154. move-result-object v2
  155. aput-object v2, v0, v1
  156. add-int/lit8 v1, v1, 0x1
  157. goto :goto_0
  158. :cond_0
  159. new-instance v9, Lokhttp3/internal/cache/DiskLruCache$Snapshot;
  160. iget-object v2, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  161. iget-object v3, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->key:Ljava/lang/String;
  162. iget-wide v4, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->sequenceNumber:J
  163. move-object v1, v9
  164. move-object v6, v0
  165. invoke-direct/range {v1 .. v7}, Lokhttp3/internal/cache/DiskLruCache$Snapshot;-><init>(Lokhttp3/internal/cache/DiskLruCache;Ljava/lang/String;J[Lokio/Source;[J)V
  166. :try_end_0
  167. .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  168. return-object v9
  169. :catch_0
  170. nop
  171. :goto_1
  172. iget-object v1, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  173. iget v1, v1, Lokhttp3/internal/cache/DiskLruCache;->valueCount:I
  174. if-ge v8, v1, :cond_1
  175. aget-object v1, v0, v8
  176. if-eqz v1, :cond_1
  177. aget-object v1, v0, v8
  178. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
  179. add-int/lit8 v8, v8, 0x1
  180. goto :goto_1
  181. :cond_1
  182. :try_start_1
  183. iget-object v0, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->this$0:Lokhttp3/internal/cache/DiskLruCache;
  184. invoke-virtual {v0, p0}, Lokhttp3/internal/cache/DiskLruCache;->removeEntry(Lokhttp3/internal/cache/DiskLruCache$Entry;)Z
  185. :try_end_1
  186. .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
  187. :catch_1
  188. const/4 v0, 0x0
  189. return-object v0
  190. :cond_2
  191. new-instance v0, Ljava/lang/AssertionError;
  192. invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
  193. goto :goto_3
  194. :goto_2
  195. throw v0
  196. :goto_3
  197. goto :goto_2
  198. .end method
  199. .method writeLengths(Lokio/BufferedSink;)V
  200. .locals 6
  201. .annotation system Ldalvik/annotation/Throws;
  202. value = {
  203. Ljava/io/IOException;
  204. }
  205. .end annotation
  206. iget-object v0, p0, Lokhttp3/internal/cache/DiskLruCache$Entry;->lengths:[J
  207. array-length v1, v0
  208. const/4 v2, 0x0
  209. :goto_0
  210. if-ge v2, v1, :cond_0
  211. aget-wide v3, v0, v2
  212. const/16 v5, 0x20
  213. invoke-interface {p1, v5}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  214. move-result-object v5
  215. invoke-interface {v5, v3, v4}, Lokio/BufferedSink;->writeDecimalLong(J)Lokio/BufferedSink;
  216. add-int/lit8 v2, v2, 0x1
  217. goto :goto_0
  218. :cond_0
  219. return-void
  220. .end method