MockWebServer$TruncatingBuffer.smali 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. .class Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokio/Sink;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lokhttp3/mockwebserver/MockWebServer;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0xa
  12. name = "TruncatingBuffer"
  13. .end annotation
  14. # instance fields
  15. .field private final buffer:Lokio/Buffer;
  16. .field private receivedByteCount:J
  17. .field private remainingByteCount:J
  18. # direct methods
  19. .method constructor <init>(J)V
  20. .locals 1
  21. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  22. new-instance v0, Lokio/Buffer;
  23. invoke-direct {v0}, Lokio/Buffer;-><init>()V
  24. iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->buffer:Lokio/Buffer;
  25. iput-wide p1, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->remainingByteCount:J
  26. return-void
  27. .end method
  28. .method static synthetic access$1900(Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;)J
  29. .locals 2
  30. iget-wide v0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->receivedByteCount:J
  31. return-wide v0
  32. .end method
  33. .method static synthetic access$2000(Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;)Lokio/Buffer;
  34. .locals 0
  35. iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->buffer:Lokio/Buffer;
  36. return-object p0
  37. .end method
  38. # virtual methods
  39. .method public close()V
  40. .locals 0
  41. .annotation system Ldalvik/annotation/Throws;
  42. value = {
  43. Ljava/io/IOException;
  44. }
  45. .end annotation
  46. return-void
  47. .end method
  48. .method public flush()V
  49. .locals 0
  50. .annotation system Ldalvik/annotation/Throws;
  51. value = {
  52. Ljava/io/IOException;
  53. }
  54. .end annotation
  55. return-void
  56. .end method
  57. .method public timeout()Lokio/Timeout;
  58. .locals 1
  59. sget-object v0, Lokio/Timeout;->NONE:Lokio/Timeout;
  60. return-object v0
  61. .end method
  62. .method public write(Lokio/Buffer;J)V
  63. .locals 7
  64. .annotation system Ldalvik/annotation/Throws;
  65. value = {
  66. Ljava/io/IOException;
  67. }
  68. .end annotation
  69. iget-wide v0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->remainingByteCount:J
  70. invoke-static {v0, v1, p2, p3}, Ljava/lang/Math;->min(JJ)J
  71. move-result-wide v0
  72. const-wide/16 v2, 0x0
  73. cmp-long v4, v0, v2
  74. if-lez v4, :cond_0
  75. iget-object v4, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->buffer:Lokio/Buffer;
  76. invoke-virtual {p1, v4, v0, v1}, Lokio/Buffer;->read(Lokio/Buffer;J)J
  77. :cond_0
  78. sub-long v4, p2, v0
  79. cmp-long v6, v4, v2
  80. if-lez v6, :cond_1
  81. invoke-virtual {p1, v4, v5}, Lokio/Buffer;->skip(J)V
  82. :cond_1
  83. iget-wide v2, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->remainingByteCount:J
  84. sub-long/2addr v2, v0
  85. iput-wide v2, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->remainingByteCount:J
  86. iget-wide v0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->receivedByteCount:J
  87. add-long/2addr v0, p2
  88. iput-wide v0, p0, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->receivedByteCount:J
  89. return-void
  90. .end method