Pipe$PipeSource.smali 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. .class final Lokio/Pipe$PipeSource;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokio/Source;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lokio/Pipe;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x10
  12. name = "PipeSource"
  13. .end annotation
  14. # instance fields
  15. .field final synthetic this$0:Lokio/Pipe;
  16. .field final timeout:Lokio/Timeout;
  17. # direct methods
  18. .method constructor <init>(Lokio/Pipe;)V
  19. .locals 0
  20. iput-object p1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  21. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  22. new-instance p1, Lokio/Timeout;
  23. invoke-direct {p1}, Lokio/Timeout;-><init>()V
  24. iput-object p1, p0, Lokio/Pipe$PipeSource;->timeout:Lokio/Timeout;
  25. return-void
  26. .end method
  27. # virtual methods
  28. .method public close()V
  29. .locals 3
  30. .annotation system Ldalvik/annotation/Throws;
  31. value = {
  32. Ljava/io/IOException;
  33. }
  34. .end annotation
  35. iget-object v0, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  36. iget-object v0, v0, Lokio/Pipe;->buffer:Lokio/Buffer;
  37. monitor-enter v0
  38. :try_start_0
  39. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  40. const/4 v2, 0x1
  41. iput-boolean v2, v1, Lokio/Pipe;->sourceClosed:Z
  42. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  43. iget-object v1, v1, Lokio/Pipe;->buffer:Lokio/Buffer;
  44. invoke-virtual {v1}, Ljava/lang/Object;->notifyAll()V
  45. monitor-exit v0
  46. return-void
  47. :catchall_0
  48. move-exception v1
  49. monitor-exit v0
  50. :try_end_0
  51. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  52. throw v1
  53. .end method
  54. .method public read(Lokio/Buffer;J)J
  55. .locals 6
  56. .annotation system Ldalvik/annotation/Throws;
  57. value = {
  58. Ljava/io/IOException;
  59. }
  60. .end annotation
  61. iget-object v0, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  62. iget-object v0, v0, Lokio/Pipe;->buffer:Lokio/Buffer;
  63. monitor-enter v0
  64. :try_start_0
  65. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  66. iget-boolean v1, v1, Lokio/Pipe;->sourceClosed:Z
  67. if-nez v1, :cond_2
  68. :goto_0
  69. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  70. iget-object v1, v1, Lokio/Pipe;->buffer:Lokio/Buffer;
  71. invoke-virtual {v1}, Lokio/Buffer;->size()J
  72. move-result-wide v1
  73. const-wide/16 v3, 0x0
  74. cmp-long v5, v1, v3
  75. if-nez v5, :cond_1
  76. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  77. iget-boolean v1, v1, Lokio/Pipe;->sinkClosed:Z
  78. if-eqz v1, :cond_0
  79. const-wide/16 p1, -0x1
  80. monitor-exit v0
  81. return-wide p1
  82. :cond_0
  83. iget-object v1, p0, Lokio/Pipe$PipeSource;->timeout:Lokio/Timeout;
  84. iget-object v2, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  85. iget-object v2, v2, Lokio/Pipe;->buffer:Lokio/Buffer;
  86. invoke-virtual {v1, v2}, Lokio/Timeout;->waitUntilNotified(Ljava/lang/Object;)V
  87. goto :goto_0
  88. :cond_1
  89. iget-object v1, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  90. iget-object v1, v1, Lokio/Pipe;->buffer:Lokio/Buffer;
  91. invoke-virtual {v1, p1, p2, p3}, Lokio/Buffer;->read(Lokio/Buffer;J)J
  92. move-result-wide p1
  93. iget-object p3, p0, Lokio/Pipe$PipeSource;->this$0:Lokio/Pipe;
  94. iget-object p3, p3, Lokio/Pipe;->buffer:Lokio/Buffer;
  95. invoke-virtual {p3}, Ljava/lang/Object;->notifyAll()V
  96. monitor-exit v0
  97. return-wide p1
  98. :cond_2
  99. new-instance p1, Ljava/lang/IllegalStateException;
  100. const-string p2, "closed"
  101. invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  102. throw p1
  103. :catchall_0
  104. move-exception p1
  105. monitor-exit v0
  106. :try_end_0
  107. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  108. goto :goto_2
  109. :goto_1
  110. throw p1
  111. :goto_2
  112. goto :goto_1
  113. .end method
  114. .method public timeout()Lokio/Timeout;
  115. .locals 1
  116. iget-object v0, p0, Lokio/Pipe$PipeSource;->timeout:Lokio/Timeout;
  117. return-object v0
  118. .end method