Http1Codec$ChunkedSink.smali 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. .class final Lokhttp3/internal/http1/Http1Codec$ChunkedSink;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokio/Sink;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lokhttp3/internal/http1/Http1Codec;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x12
  12. name = "ChunkedSink"
  13. .end annotation
  14. # instance fields
  15. .field private closed:Z
  16. .field final synthetic this$0:Lokhttp3/internal/http1/Http1Codec;
  17. .field private final timeout:Lokio/ForwardingTimeout;
  18. # direct methods
  19. .method constructor <init>(Lokhttp3/internal/http1/Http1Codec;)V
  20. .locals 1
  21. iput-object p1, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  22. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  23. new-instance p1, Lokio/ForwardingTimeout;
  24. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  25. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  26. invoke-interface {v0}, Lokio/Sink;->timeout()Lokio/Timeout;
  27. move-result-object v0
  28. invoke-direct {p1, v0}, Lokio/ForwardingTimeout;-><init>(Lokio/Timeout;)V
  29. iput-object p1, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->timeout:Lokio/ForwardingTimeout;
  30. return-void
  31. .end method
  32. # virtual methods
  33. .method public declared-synchronized close()V
  34. .locals 2
  35. .annotation system Ldalvik/annotation/Throws;
  36. value = {
  37. Ljava/io/IOException;
  38. }
  39. .end annotation
  40. monitor-enter p0
  41. :try_start_0
  42. iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->closed:Z
  43. :try_end_0
  44. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  45. if-eqz v0, :cond_0
  46. monitor-exit p0
  47. return-void
  48. :cond_0
  49. const/4 v0, 0x1
  50. :try_start_1
  51. iput-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->closed:Z
  52. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  53. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  54. const-string v1, "0\r\n\r\n"
  55. invoke-interface {v0, v1}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
  56. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  57. iget-object v1, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->timeout:Lokio/ForwardingTimeout;
  58. invoke-virtual {v0, v1}, Lokhttp3/internal/http1/Http1Codec;->detachTimeout(Lokio/ForwardingTimeout;)V
  59. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  60. const/4 v1, 0x3
  61. iput v1, v0, Lokhttp3/internal/http1/Http1Codec;->state:I
  62. :try_end_1
  63. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  64. monitor-exit p0
  65. return-void
  66. :catchall_0
  67. move-exception v0
  68. monitor-exit p0
  69. throw v0
  70. .end method
  71. .method public declared-synchronized flush()V
  72. .locals 1
  73. .annotation system Ldalvik/annotation/Throws;
  74. value = {
  75. Ljava/io/IOException;
  76. }
  77. .end annotation
  78. monitor-enter p0
  79. :try_start_0
  80. iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->closed:Z
  81. :try_end_0
  82. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  83. if-eqz v0, :cond_0
  84. monitor-exit p0
  85. return-void
  86. :cond_0
  87. :try_start_1
  88. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  89. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  90. invoke-interface {v0}, Lokio/BufferedSink;->flush()V
  91. :try_end_1
  92. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  93. monitor-exit p0
  94. return-void
  95. :catchall_0
  96. move-exception v0
  97. monitor-exit p0
  98. throw v0
  99. .end method
  100. .method public timeout()Lokio/Timeout;
  101. .locals 1
  102. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->timeout:Lokio/ForwardingTimeout;
  103. return-object v0
  104. .end method
  105. .method public write(Lokio/Buffer;J)V
  106. .locals 3
  107. .annotation system Ldalvik/annotation/Throws;
  108. value = {
  109. Ljava/io/IOException;
  110. }
  111. .end annotation
  112. iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->closed:Z
  113. if-nez v0, :cond_1
  114. const-wide/16 v0, 0x0
  115. cmp-long v2, p2, v0
  116. if-nez v2, :cond_0
  117. return-void
  118. :cond_0
  119. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  120. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  121. invoke-interface {v0, p2, p3}, Lokio/BufferedSink;->writeHexadecimalUnsignedLong(J)Lokio/BufferedSink;
  122. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  123. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  124. const-string v1, "\r\n"
  125. invoke-interface {v0, v1}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
  126. iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  127. iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  128. invoke-interface {v0, p1, p2, p3}, Lokio/Sink;->write(Lokio/Buffer;J)V
  129. iget-object p1, p0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;->this$0:Lokhttp3/internal/http1/Http1Codec;
  130. iget-object p1, p1, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
  131. invoke-interface {p1, v1}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
  132. return-void
  133. :cond_1
  134. new-instance p1, Ljava/lang/IllegalStateException;
  135. const-string p2, "closed"
  136. invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  137. throw p1
  138. .end method