RequestBody.smali 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. .class public abstract Lokhttp3/RequestBody;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # direct methods
  5. .method public constructor <init>()V
  6. .locals 0
  7. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  8. return-void
  9. .end method
  10. .method public static create(Lokhttp3/MediaType;Ljava/io/File;)Lokhttp3/RequestBody;
  11. .locals 1
  12. if-eqz p1, :cond_0
  13. new-instance v0, Lokhttp3/RequestBody$3;
  14. invoke-direct {v0, p0, p1}, Lokhttp3/RequestBody$3;-><init>(Lokhttp3/MediaType;Ljava/io/File;)V
  15. return-object v0
  16. :cond_0
  17. new-instance p0, Ljava/lang/NullPointerException;
  18. const-string p1, "content == null"
  19. invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  20. throw p0
  21. .end method
  22. .method public static create(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/RequestBody;
  23. .locals 2
  24. sget-object v0, Lokhttp3/internal/Util;->UTF_8:Ljava/nio/charset/Charset;
  25. if-eqz p0, :cond_0
  26. invoke-virtual {p0}, Lokhttp3/MediaType;->charset()Ljava/nio/charset/Charset;
  27. move-result-object v0
  28. if-nez v0, :cond_0
  29. sget-object v0, Lokhttp3/internal/Util;->UTF_8:Ljava/nio/charset/Charset;
  30. new-instance v1, Ljava/lang/StringBuilder;
  31. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  32. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  33. const-string p0, "; charset=utf-8"
  34. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  35. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  36. move-result-object p0
  37. invoke-static {p0}, Lokhttp3/MediaType;->parse(Ljava/lang/String;)Lokhttp3/MediaType;
  38. move-result-object p0
  39. :cond_0
  40. invoke-virtual {p1, v0}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
  41. move-result-object p1
  42. invoke-static {p0, p1}, Lokhttp3/RequestBody;->create(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;
  43. move-result-object p0
  44. return-object p0
  45. .end method
  46. .method public static create(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;
  47. .locals 1
  48. new-instance v0, Lokhttp3/RequestBody$1;
  49. invoke-direct {v0, p0, p1}, Lokhttp3/RequestBody$1;-><init>(Lokhttp3/MediaType;Lokio/ByteString;)V
  50. return-object v0
  51. .end method
  52. .method public static create(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;
  53. .locals 2
  54. array-length v0, p1
  55. const/4 v1, 0x0
  56. invoke-static {p0, p1, v1, v0}, Lokhttp3/RequestBody;->create(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;
  57. move-result-object p0
  58. return-object p0
  59. .end method
  60. .method public static create(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;
  61. .locals 7
  62. if-eqz p1, :cond_0
  63. array-length v0, p1
  64. int-to-long v1, v0
  65. int-to-long v3, p2
  66. int-to-long v5, p3
  67. invoke-static/range {v1 .. v6}, Lokhttp3/internal/Util;->checkOffsetAndCount(JJJ)V
  68. new-instance v0, Lokhttp3/RequestBody$2;
  69. invoke-direct {v0, p0, p3, p1, p2}, Lokhttp3/RequestBody$2;-><init>(Lokhttp3/MediaType;I[BI)V
  70. return-object v0
  71. :cond_0
  72. new-instance p0, Ljava/lang/NullPointerException;
  73. const-string p1, "content == null"
  74. invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  75. throw p0
  76. .end method
  77. # virtual methods
  78. .method public contentLength()J
  79. .locals 2
  80. .annotation system Ldalvik/annotation/Throws;
  81. value = {
  82. Ljava/io/IOException;
  83. }
  84. .end annotation
  85. const-wide/16 v0, -0x1
  86. return-wide v0
  87. .end method
  88. .method public abstract contentType()Lokhttp3/MediaType;
  89. .end method
  90. .method public abstract writeTo(Lokio/BufferedSink;)V
  91. .annotation system Ldalvik/annotation/Throws;
  92. value = {
  93. Ljava/io/IOException;
  94. }
  95. .end annotation
  96. .end method