FileSystem$1.smali 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. .class final Lokhttp3/internal/io/FileSystem$1;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/internal/io/FileSystem;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lokhttp3/internal/io/FileSystem;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x0
  12. name = null
  13. .end annotation
  14. # direct methods
  15. .method constructor <init>()V
  16. .locals 0
  17. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  18. return-void
  19. .end method
  20. # virtual methods
  21. .method public appendingSink(Ljava/io/File;)Lokio/Sink;
  22. .locals 1
  23. .annotation system Ldalvik/annotation/Throws;
  24. value = {
  25. Ljava/io/FileNotFoundException;
  26. }
  27. .end annotation
  28. :try_start_0
  29. invoke-static {p1}, Lokio/Okio;->appendingSink(Ljava/io/File;)Lokio/Sink;
  30. move-result-object p1
  31. :try_end_0
  32. .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  33. return-object p1
  34. :catch_0
  35. invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;
  36. move-result-object v0
  37. invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z
  38. invoke-static {p1}, Lokio/Okio;->appendingSink(Ljava/io/File;)Lokio/Sink;
  39. move-result-object p1
  40. return-object p1
  41. .end method
  42. .method public delete(Ljava/io/File;)V
  43. .locals 3
  44. .annotation system Ldalvik/annotation/Throws;
  45. value = {
  46. Ljava/io/IOException;
  47. }
  48. .end annotation
  49. invoke-virtual {p1}, Ljava/io/File;->delete()Z
  50. move-result v0
  51. if-nez v0, :cond_1
  52. invoke-virtual {p1}, Ljava/io/File;->exists()Z
  53. move-result v0
  54. if-nez v0, :cond_0
  55. goto :goto_0
  56. :cond_0
  57. new-instance v0, Ljava/io/IOException;
  58. new-instance v1, Ljava/lang/StringBuilder;
  59. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  60. const-string v2, "failed to delete "
  61. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  62. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  63. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  64. move-result-object p1
  65. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  66. throw v0
  67. :cond_1
  68. :goto_0
  69. return-void
  70. .end method
  71. .method public deleteContents(Ljava/io/File;)V
  72. .locals 4
  73. .annotation system Ldalvik/annotation/Throws;
  74. value = {
  75. Ljava/io/IOException;
  76. }
  77. .end annotation
  78. invoke-virtual {p1}, Ljava/io/File;->listFiles()[Ljava/io/File;
  79. move-result-object v0
  80. if-eqz v0, :cond_3
  81. array-length p1, v0
  82. const/4 v1, 0x0
  83. :goto_0
  84. if-ge v1, p1, :cond_2
  85. aget-object v2, v0, v1
  86. invoke-virtual {v2}, Ljava/io/File;->isDirectory()Z
  87. move-result v3
  88. if-eqz v3, :cond_0
  89. invoke-virtual {p0, v2}, Lokhttp3/internal/io/FileSystem$1;->deleteContents(Ljava/io/File;)V
  90. :cond_0
  91. invoke-virtual {v2}, Ljava/io/File;->delete()Z
  92. move-result v3
  93. if-eqz v3, :cond_1
  94. add-int/lit8 v1, v1, 0x1
  95. goto :goto_0
  96. :cond_1
  97. new-instance p1, Ljava/io/IOException;
  98. new-instance v0, Ljava/lang/StringBuilder;
  99. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  100. const-string v1, "failed to delete "
  101. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  102. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  103. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  104. move-result-object v0
  105. invoke-direct {p1, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  106. throw p1
  107. :cond_2
  108. return-void
  109. :cond_3
  110. new-instance v0, Ljava/io/IOException;
  111. new-instance v1, Ljava/lang/StringBuilder;
  112. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  113. const-string v2, "not a readable directory: "
  114. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  115. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  116. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  117. move-result-object p1
  118. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  119. goto :goto_2
  120. :goto_1
  121. throw v0
  122. :goto_2
  123. goto :goto_1
  124. .end method
  125. .method public exists(Ljava/io/File;)Z
  126. .locals 0
  127. invoke-virtual {p1}, Ljava/io/File;->exists()Z
  128. move-result p1
  129. return p1
  130. .end method
  131. .method public rename(Ljava/io/File;Ljava/io/File;)V
  132. .locals 3
  133. .annotation system Ldalvik/annotation/Throws;
  134. value = {
  135. Ljava/io/IOException;
  136. }
  137. .end annotation
  138. invoke-virtual {p0, p2}, Lokhttp3/internal/io/FileSystem$1;->delete(Ljava/io/File;)V
  139. invoke-virtual {p1, p2}, Ljava/io/File;->renameTo(Ljava/io/File;)Z
  140. move-result v0
  141. if-eqz v0, :cond_0
  142. return-void
  143. :cond_0
  144. new-instance v0, Ljava/io/IOException;
  145. new-instance v1, Ljava/lang/StringBuilder;
  146. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  147. const-string v2, "failed to rename "
  148. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  149. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  150. const-string p1, " to "
  151. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  152. invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  153. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  154. move-result-object p1
  155. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  156. throw v0
  157. .end method
  158. .method public sink(Ljava/io/File;)Lokio/Sink;
  159. .locals 1
  160. .annotation system Ldalvik/annotation/Throws;
  161. value = {
  162. Ljava/io/FileNotFoundException;
  163. }
  164. .end annotation
  165. :try_start_0
  166. invoke-static {p1}, Lokio/Okio;->sink(Ljava/io/File;)Lokio/Sink;
  167. move-result-object p1
  168. :try_end_0
  169. .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  170. return-object p1
  171. :catch_0
  172. invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;
  173. move-result-object v0
  174. invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z
  175. invoke-static {p1}, Lokio/Okio;->sink(Ljava/io/File;)Lokio/Sink;
  176. move-result-object p1
  177. return-object p1
  178. .end method
  179. .method public size(Ljava/io/File;)J
  180. .locals 2
  181. invoke-virtual {p1}, Ljava/io/File;->length()J
  182. move-result-wide v0
  183. return-wide v0
  184. .end method
  185. .method public source(Ljava/io/File;)Lokio/Source;
  186. .locals 0
  187. .annotation system Ldalvik/annotation/Throws;
  188. value = {
  189. Ljava/io/FileNotFoundException;
  190. }
  191. .end annotation
  192. invoke-static {p1}, Lokio/Okio;->source(Ljava/io/File;)Lokio/Source;
  193. move-result-object p1
  194. return-object p1
  195. .end method