Okio.smali 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. .class public final Lokio/Okio;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # static fields
  5. .field static final logger:Ljava/util/logging/Logger;
  6. # direct methods
  7. .method static constructor <clinit>()V
  8. .locals 1
  9. const-class v0, Lokio/Okio;
  10. invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
  11. move-result-object v0
  12. invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
  13. move-result-object v0
  14. sput-object v0, Lokio/Okio;->logger:Ljava/util/logging/Logger;
  15. return-void
  16. .end method
  17. .method private constructor <init>()V
  18. .locals 0
  19. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  20. return-void
  21. .end method
  22. .method public static appendingSink(Ljava/io/File;)Lokio/Sink;
  23. .locals 2
  24. .annotation system Ldalvik/annotation/Throws;
  25. value = {
  26. Ljava/io/FileNotFoundException;
  27. }
  28. .end annotation
  29. if-eqz p0, :cond_0
  30. new-instance v0, Ljava/io/FileOutputStream;
  31. const/4 v1, 0x1
  32. invoke-direct {v0, p0, v1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
  33. invoke-static {v0}, Lokio/Okio;->sink(Ljava/io/OutputStream;)Lokio/Sink;
  34. move-result-object p0
  35. return-object p0
  36. :cond_0
  37. new-instance p0, Ljava/lang/IllegalArgumentException;
  38. const-string v0, "file == null"
  39. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  40. throw p0
  41. .end method
  42. .method public static blackhole()Lokio/Sink;
  43. .locals 1
  44. new-instance v0, Lokio/Okio$3;
  45. invoke-direct {v0}, Lokio/Okio$3;-><init>()V
  46. return-object v0
  47. .end method
  48. .method public static buffer(Lokio/Sink;)Lokio/BufferedSink;
  49. .locals 1
  50. new-instance v0, Lokio/RealBufferedSink;
  51. invoke-direct {v0, p0}, Lokio/RealBufferedSink;-><init>(Lokio/Sink;)V
  52. return-object v0
  53. .end method
  54. .method public static buffer(Lokio/Source;)Lokio/BufferedSource;
  55. .locals 1
  56. new-instance v0, Lokio/RealBufferedSource;
  57. invoke-direct {v0, p0}, Lokio/RealBufferedSource;-><init>(Lokio/Source;)V
  58. return-object v0
  59. .end method
  60. .method static isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  61. .locals 1
  62. invoke-virtual {p0}, Ljava/lang/AssertionError;->getCause()Ljava/lang/Throwable;
  63. move-result-object v0
  64. if-eqz v0, :cond_0
  65. invoke-virtual {p0}, Ljava/lang/AssertionError;->getMessage()Ljava/lang/String;
  66. move-result-object v0
  67. if-eqz v0, :cond_0
  68. invoke-virtual {p0}, Ljava/lang/AssertionError;->getMessage()Ljava/lang/String;
  69. move-result-object p0
  70. const-string v0, "getsockname failed"
  71. invoke-virtual {p0, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
  72. move-result p0
  73. if-eqz p0, :cond_0
  74. const/4 p0, 0x1
  75. goto :goto_0
  76. :cond_0
  77. const/4 p0, 0x0
  78. :goto_0
  79. return p0
  80. .end method
  81. .method public static sink(Ljava/io/File;)Lokio/Sink;
  82. .locals 1
  83. .annotation system Ldalvik/annotation/Throws;
  84. value = {
  85. Ljava/io/FileNotFoundException;
  86. }
  87. .end annotation
  88. if-eqz p0, :cond_0
  89. new-instance v0, Ljava/io/FileOutputStream;
  90. invoke-direct {v0, p0}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
  91. invoke-static {v0}, Lokio/Okio;->sink(Ljava/io/OutputStream;)Lokio/Sink;
  92. move-result-object p0
  93. return-object p0
  94. :cond_0
  95. new-instance p0, Ljava/lang/IllegalArgumentException;
  96. const-string v0, "file == null"
  97. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  98. throw p0
  99. .end method
  100. .method public static sink(Ljava/io/OutputStream;)Lokio/Sink;
  101. .locals 1
  102. new-instance v0, Lokio/Timeout;
  103. invoke-direct {v0}, Lokio/Timeout;-><init>()V
  104. invoke-static {p0, v0}, Lokio/Okio;->sink(Ljava/io/OutputStream;Lokio/Timeout;)Lokio/Sink;
  105. move-result-object p0
  106. return-object p0
  107. .end method
  108. .method private static sink(Ljava/io/OutputStream;Lokio/Timeout;)Lokio/Sink;
  109. .locals 1
  110. if-eqz p0, :cond_1
  111. if-eqz p1, :cond_0
  112. new-instance v0, Lokio/Okio$1;
  113. invoke-direct {v0, p1, p0}, Lokio/Okio$1;-><init>(Lokio/Timeout;Ljava/io/OutputStream;)V
  114. return-object v0
  115. :cond_0
  116. new-instance p0, Ljava/lang/IllegalArgumentException;
  117. const-string p1, "timeout == null"
  118. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  119. throw p0
  120. :cond_1
  121. new-instance p0, Ljava/lang/IllegalArgumentException;
  122. const-string p1, "out == null"
  123. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  124. throw p0
  125. .end method
  126. .method public static sink(Ljava/net/Socket;)Lokio/Sink;
  127. .locals 1
  128. .annotation system Ldalvik/annotation/Throws;
  129. value = {
  130. Ljava/io/IOException;
  131. }
  132. .end annotation
  133. if-eqz p0, :cond_0
  134. invoke-static {p0}, Lokio/Okio;->timeout(Ljava/net/Socket;)Lokio/AsyncTimeout;
  135. move-result-object v0
  136. invoke-virtual {p0}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream;
  137. move-result-object p0
  138. invoke-static {p0, v0}, Lokio/Okio;->sink(Ljava/io/OutputStream;Lokio/Timeout;)Lokio/Sink;
  139. move-result-object p0
  140. invoke-virtual {v0, p0}, Lokio/AsyncTimeout;->sink(Lokio/Sink;)Lokio/Sink;
  141. move-result-object p0
  142. return-object p0
  143. :cond_0
  144. new-instance p0, Ljava/lang/IllegalArgumentException;
  145. const-string v0, "socket == null"
  146. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  147. throw p0
  148. .end method
  149. .method public static varargs sink(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Lokio/Sink;
  150. .locals 0
  151. .annotation system Ldalvik/annotation/Throws;
  152. value = {
  153. Ljava/io/IOException;
  154. }
  155. .end annotation
  156. if-eqz p0, :cond_0
  157. invoke-static {p0, p1}, Ljava/nio/file/Files;->newOutputStream(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
  158. move-result-object p0
  159. invoke-static {p0}, Lokio/Okio;->sink(Ljava/io/OutputStream;)Lokio/Sink;
  160. move-result-object p0
  161. return-object p0
  162. :cond_0
  163. new-instance p0, Ljava/lang/IllegalArgumentException;
  164. const-string p1, "path == null"
  165. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  166. throw p0
  167. .end method
  168. .method public static source(Ljava/io/File;)Lokio/Source;
  169. .locals 1
  170. .annotation system Ldalvik/annotation/Throws;
  171. value = {
  172. Ljava/io/FileNotFoundException;
  173. }
  174. .end annotation
  175. if-eqz p0, :cond_0
  176. new-instance v0, Ljava/io/FileInputStream;
  177. invoke-direct {v0, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
  178. invoke-static {v0}, Lokio/Okio;->source(Ljava/io/InputStream;)Lokio/Source;
  179. move-result-object p0
  180. return-object p0
  181. :cond_0
  182. new-instance p0, Ljava/lang/IllegalArgumentException;
  183. const-string v0, "file == null"
  184. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  185. throw p0
  186. .end method
  187. .method public static source(Ljava/io/InputStream;)Lokio/Source;
  188. .locals 1
  189. new-instance v0, Lokio/Timeout;
  190. invoke-direct {v0}, Lokio/Timeout;-><init>()V
  191. invoke-static {p0, v0}, Lokio/Okio;->source(Ljava/io/InputStream;Lokio/Timeout;)Lokio/Source;
  192. move-result-object p0
  193. return-object p0
  194. .end method
  195. .method private static source(Ljava/io/InputStream;Lokio/Timeout;)Lokio/Source;
  196. .locals 1
  197. if-eqz p0, :cond_1
  198. if-eqz p1, :cond_0
  199. new-instance v0, Lokio/Okio$2;
  200. invoke-direct {v0, p1, p0}, Lokio/Okio$2;-><init>(Lokio/Timeout;Ljava/io/InputStream;)V
  201. return-object v0
  202. :cond_0
  203. new-instance p0, Ljava/lang/IllegalArgumentException;
  204. const-string p1, "timeout == null"
  205. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  206. throw p0
  207. :cond_1
  208. new-instance p0, Ljava/lang/IllegalArgumentException;
  209. const-string p1, "in == null"
  210. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  211. throw p0
  212. .end method
  213. .method public static source(Ljava/net/Socket;)Lokio/Source;
  214. .locals 1
  215. .annotation system Ldalvik/annotation/Throws;
  216. value = {
  217. Ljava/io/IOException;
  218. }
  219. .end annotation
  220. if-eqz p0, :cond_0
  221. invoke-static {p0}, Lokio/Okio;->timeout(Ljava/net/Socket;)Lokio/AsyncTimeout;
  222. move-result-object v0
  223. invoke-virtual {p0}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream;
  224. move-result-object p0
  225. invoke-static {p0, v0}, Lokio/Okio;->source(Ljava/io/InputStream;Lokio/Timeout;)Lokio/Source;
  226. move-result-object p0
  227. invoke-virtual {v0, p0}, Lokio/AsyncTimeout;->source(Lokio/Source;)Lokio/Source;
  228. move-result-object p0
  229. return-object p0
  230. :cond_0
  231. new-instance p0, Ljava/lang/IllegalArgumentException;
  232. const-string v0, "socket == null"
  233. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  234. throw p0
  235. .end method
  236. .method public static varargs source(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Lokio/Source;
  237. .locals 0
  238. .annotation system Ldalvik/annotation/Throws;
  239. value = {
  240. Ljava/io/IOException;
  241. }
  242. .end annotation
  243. if-eqz p0, :cond_0
  244. invoke-static {p0, p1}, Ljava/nio/file/Files;->newInputStream(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
  245. move-result-object p0
  246. invoke-static {p0}, Lokio/Okio;->source(Ljava/io/InputStream;)Lokio/Source;
  247. move-result-object p0
  248. return-object p0
  249. :cond_0
  250. new-instance p0, Ljava/lang/IllegalArgumentException;
  251. const-string p1, "path == null"
  252. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  253. throw p0
  254. .end method
  255. .method private static timeout(Ljava/net/Socket;)Lokio/AsyncTimeout;
  256. .locals 1
  257. new-instance v0, Lokio/Okio$4;
  258. invoke-direct {v0, p0}, Lokio/Okio$4;-><init>(Ljava/net/Socket;)V
  259. return-object v0
  260. .end method