Okio$2.smali 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. .class final Lokio/Okio$2;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokio/Source;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingMethod;
  8. value = Lokio/Okio;->source(Ljava/io/InputStream;Lokio/Timeout;)Lokio/Source;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x0
  12. name = null
  13. .end annotation
  14. # instance fields
  15. .field final synthetic val$in:Ljava/io/InputStream;
  16. .field final synthetic val$timeout:Lokio/Timeout;
  17. # direct methods
  18. .method constructor <init>(Lokio/Timeout;Ljava/io/InputStream;)V
  19. .locals 0
  20. iput-object p1, p0, Lokio/Okio$2;->val$timeout:Lokio/Timeout;
  21. iput-object p2, p0, Lokio/Okio$2;->val$in:Ljava/io/InputStream;
  22. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  23. return-void
  24. .end method
  25. # virtual methods
  26. .method public close()V
  27. .locals 1
  28. .annotation system Ldalvik/annotation/Throws;
  29. value = {
  30. Ljava/io/IOException;
  31. }
  32. .end annotation
  33. iget-object v0, p0, Lokio/Okio$2;->val$in:Ljava/io/InputStream;
  34. invoke-virtual {v0}, Ljava/io/InputStream;->close()V
  35. return-void
  36. .end method
  37. .method public read(Lokio/Buffer;J)J
  38. .locals 3
  39. .annotation system Ldalvik/annotation/Throws;
  40. value = {
  41. Ljava/io/IOException;
  42. }
  43. .end annotation
  44. const-wide/16 v0, 0x0
  45. cmp-long v2, p2, v0
  46. if-ltz v2, :cond_3
  47. cmp-long v2, p2, v0
  48. if-nez v2, :cond_0
  49. return-wide v0
  50. :cond_0
  51. :try_start_0
  52. iget-object v0, p0, Lokio/Okio$2;->val$timeout:Lokio/Timeout;
  53. invoke-virtual {v0}, Lokio/Timeout;->throwIfReached()V
  54. const/4 v0, 0x1
  55. invoke-virtual {p1, v0}, Lokio/Buffer;->writableSegment(I)Lokio/Segment;
  56. move-result-object v0
  57. iget v1, v0, Lokio/Segment;->limit:I
  58. rsub-int v1, v1, 0x2000
  59. int-to-long v1, v1
  60. invoke-static {p2, p3, v1, v2}, Ljava/lang/Math;->min(JJ)J
  61. move-result-wide p2
  62. long-to-int p3, p2
  63. iget-object p2, p0, Lokio/Okio$2;->val$in:Ljava/io/InputStream;
  64. iget-object v1, v0, Lokio/Segment;->data:[B
  65. iget v2, v0, Lokio/Segment;->limit:I
  66. invoke-virtual {p2, v1, v2, p3}, Ljava/io/InputStream;->read([BII)I
  67. move-result p2
  68. const/4 p3, -0x1
  69. if-ne p2, p3, :cond_1
  70. const-wide/16 p1, -0x1
  71. return-wide p1
  72. :cond_1
  73. iget p3, v0, Lokio/Segment;->limit:I
  74. add-int/2addr p3, p2
  75. iput p3, v0, Lokio/Segment;->limit:I
  76. iget-wide v0, p1, Lokio/Buffer;->size:J
  77. int-to-long p2, p2
  78. add-long/2addr v0, p2
  79. iput-wide v0, p1, Lokio/Buffer;->size:J
  80. :try_end_0
  81. .catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_0
  82. return-wide p2
  83. :catch_0
  84. move-exception p1
  85. invoke-static {p1}, Lokio/Okio;->isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  86. move-result p2
  87. if-eqz p2, :cond_2
  88. new-instance p2, Ljava/io/IOException;
  89. invoke-direct {p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
  90. throw p2
  91. :cond_2
  92. throw p1
  93. :cond_3
  94. new-instance p1, Ljava/lang/IllegalArgumentException;
  95. new-instance v0, Ljava/lang/StringBuilder;
  96. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  97. const-string v1, "byteCount < 0: "
  98. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  99. invoke-virtual {v0, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
  100. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  101. move-result-object p2
  102. invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  103. throw p1
  104. .end method
  105. .method public timeout()Lokio/Timeout;
  106. .locals 1
  107. iget-object v0, p0, Lokio/Okio$2;->val$timeout:Lokio/Timeout;
  108. return-object v0
  109. .end method
  110. .method public toString()Ljava/lang/String;
  111. .locals 2
  112. new-instance v0, Ljava/lang/StringBuilder;
  113. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  114. const-string v1, "source("
  115. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  116. iget-object v1, p0, Lokio/Okio$2;->val$in:Ljava/io/InputStream;
  117. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  118. const-string v1, ")"
  119. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  120. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  121. move-result-object v0
  122. return-object v0
  123. .end method