Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 21 - 30 of 77 for MediaType (0.04 seconds)

  1. okhttp/src/commonJvmAndroid/kotlin/okhttp3/ResponseBody.kt

        @JvmName("create")
        fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody =
          Buffer()
            .write(this)
            .asResponseBody(contentType, size.toLong())
    
        /** Returns a new response body that transmits this byte string. */
        @JvmStatic
        @JvmName("create")
        fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody =
          Buffer()
            .write(this)
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue May 27 14:51:25 GMT 2025
    - 11.6K bytes
    - Click Count (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/UnreadableResponseBody.kt

     */
    package okhttp3.internal
    
    import okhttp3.MediaType
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okio.Buffer
    import okio.Source
    import okio.Timeout
    import okio.buffer
    
    internal class UnreadableResponseBody(
      private val mediaType: MediaType?,
      private val contentLength: Long,
    ) : ResponseBody(),
      Source {
      override fun contentType() = mediaType
    
      override fun contentLength() = contentLength
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue May 27 15:19:53 GMT 2025
    - 1.7K bytes
    - Click Count (0)
  3. samples/guide/src/main/java/okhttp3/recipes/PostStreamingWithPipe.java

    package okhttp3.recipes;
    
    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    import okio.BufferedSink;
    import okio.Okio;
    import okio.Pipe;
    
    public final class PostStreamingWithPipe {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 3.1K bytes
    - Click Count (0)
  4. samples/crawler/src/main/java/okhttp3/sample/Crawler.java

          String contentType = response.header("Content-Type");
          if (responseCode != 200 || contentType == null) {
            return;
          }
    
          MediaType mediaType = MediaType.parse(contentType);
          if (mediaType == null || !mediaType.subtype().equalsIgnoreCase("html")) {
            return;
          }
    
          Document document = Jsoup.parse(response.body().string(), url.toString());
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Jul 23 00:58:06 GMT 2025
    - 5K bytes
    - Click Count (0)
  5. samples/guide/src/main/java/okhttp3/recipes/PostString.java

     */
    package okhttp3.recipes;
    
    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public final class PostString {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.7K bytes
    - Click Count (0)
  6. okhttp/src/commonJvmAndroid/kotlin/okhttp3/FormBody.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package okhttp3
    
    import java.io.IOException
    import java.nio.charset.Charset
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.internal.toImmutableList
    import okhttp3.internal.url.FORM_ENCODE_SET
    import okhttp3.internal.url.canonicalizeWithCharset
    import okhttp3.internal.url.percentDecode
    import okio.Buffer
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 4.3K bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/MediaTypeGetTest.kt

     * limitations under the License.
     */
    package okhttp3
    
    import kotlin.test.assertEquals
    import kotlin.test.assertFailsWith
    import okhttp3.MediaType.Companion.toMediaType
    
    open class MediaTypeGetTest : MediaTypeTest() {
      override fun parse(string: String): MediaType = string.toMediaType()
    
      override fun assertInvalid(
        string: String,
        exceptionMessage: String?,
      ) {
        val e =
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 1.1K bytes
    - Click Count (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/CommonRequestBodyTest.kt

    class CommonRequestBodyTest {
      @Test
      fun correctContentType() {
        val body = "Body"
        val requestBody = body.toRequestBody(MediaType("text/plain", "text", "plain", arrayOf()))
    
        val contentType = requestBody.contentType()!!
    
        assertThat(contentType.mediaType).isEqualTo("text/plain; charset=utf-8")
        assertThat(contentType.parameter("charset")).isEqualTo("utf-8")
      }
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 1.1K bytes
    - Click Count (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/internal/duplex/AsyncRequestBody.kt

     */
    package okhttp3.internal.duplex
    
    import java.util.concurrent.BlockingQueue
    import java.util.concurrent.LinkedBlockingQueue
    import java.util.concurrent.TimeUnit.SECONDS
    import okhttp3.MediaType
    import okhttp3.RequestBody
    import okio.BufferedSink
    import org.junit.jupiter.api.Assertions.assertTrue
    
    /** A duplex request body that keeps the provided sinks so they can be written to later.  */
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 1.5K bytes
    - Click Count (0)
  10. samples/guide/src/main/java/okhttp3/guide/PostExample.java

     * limitations under the License.
     */
    package okhttp3.guide;
    
    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public class PostExample {
      public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
    
      final OkHttpClient client = new OkHttpClient();
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2K bytes
    - Click Count (0)
Back to Top