Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for charStream (0.13 sec)

  1. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

        val body = body("")
        assertThat(exhaust(body.charStream())).isEqualTo("")
      }
    
      @Test
      fun readerLooksLikeBomButTooShort() {
        val body = body("000048")
        assertThat(exhaust(body.charStream())).isEqualTo("\u0000\u0000H")
      }
    
      @Test
      fun readerDefaultsToUtf8() {
        val body = body("68656c6c6f")
        assertThat(exhaust(body.charStream())).isEqualTo("hello")
      }
    
      @Test
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon May 13 13:42:37 UTC 2024
    - 13K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/ResponseBody.kt

     * re-read the bytes of the response. Use this one shot to read the entire response into memory with
     * [bytes] or [string]. Or stream the response with either [source], [byteStream], or [charStream].
     */
    abstract class ResponseBody : Closeable {
      /** Multiple calls to [charStream] must return the same instance. */
      private var reader: Reader? = null
    
      abstract fun contentType(): MediaType?
    
      /**
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

            override fun close() = TODO()
          }
        val byteStream = responseBody.byteStream()
        val source = responseBody.source()
        val bytes = responseBody.bytes()
        val charStream = responseBody.charStream()
        val string = responseBody.string()
        responseBody.close()
        responseBody = "".toResponseBody("".toMediaType())
        responseBody = "".toResponseBody(null)
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 01 14:21:25 UTC 2024
    - 46.5K bytes
    - Viewed (0)
  4. docs/recipes.md

    [Moshi](https://github.com/square/moshi) is a handy API for converting between JSON and Java objects. Here we're using it to decode a JSON response from a GitHub API.
    
    Note that `ResponseBody.charStream()` uses the `Content-Type` response header to select which charset to use when decoding the response body. It defaults to `UTF-8` if no charset is specified.
    
    === ":material-language-kotlin: Kotlin"
        ```kotlin
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Fri Feb 18 08:52:22 UTC 2022
    - 40.2K bytes
    - Viewed (0)
  5. docs/changelogs/changelog_3x.md

        literals are now Huffman-encoded.
     *  New: Expose `Part` headers and body in `Multipart`.
     *  New: Make `ResponseBody.string()` and `ResponseBody.charStream()` BOM-aware. If your HTTP
        response body begins with a [byte order mark][bom] it will be consumed and used to select a
        charset for the remaining bytes. Most applications should not need a byte order mark.
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Feb 06 14:55:54 UTC 2022
    - 50.8K bytes
    - Viewed (0)
  6. okhttp/api/okhttp.api

    	public fun <init> ()V
    	public final fun byteStream ()Ljava/io/InputStream;
    	public final fun byteString ()Lokio/ByteString;
    	public final fun bytes ()[B
    	public final fun charStream ()Ljava/io/Reader;
    	public fun close ()V
    	public abstract fun contentLength ()J
    	public abstract fun contentType ()Lokhttp3/MediaType;
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 15 13:41:01 UTC 2024
    - 70.2K bytes
    - Viewed (0)
  7. guava/src/com/google/common/io/CharStreams.java

    @J2ktIncompatible
    @GwtIncompatible
    @ElementTypesAreNonnullByDefault
    public final class CharStreams {
    
      // 2K chars (4K bytes)
      private static final int DEFAULT_BUF_SIZE = 0x800;
    
      /** Creates a new {@code CharBuffer} for buffering reads or writes. */
      static CharBuffer createBuffer() {
        return CharBuffer.allocate(DEFAULT_BUF_SIZE);
      }
    
      private CharStreams() {}
    
      /**
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed May 17 14:35:11 UTC 2023
    - 10.9K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/io/CharStreamsTest.java

        Reader empty = new StringReader("");
        assertEquals(0, CharStreams.exhaust(empty));
        assertEquals(-1, empty.read());
      }
    
      public void testExhaust_readable() throws IOException {
        CharBuffer buf = CharBuffer.wrap(ASCII);
        assertEquals(ASCII.length(), CharStreams.exhaust(buf));
        assertEquals(0, buf.remaining());
        assertEquals(0, CharStreams.exhaust(buf));
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 21 14:28:19 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/io/CharStreamsTest.java

        Reader empty = new StringReader("");
        assertEquals(0, CharStreams.exhaust(empty));
        assertEquals(-1, empty.read());
      }
    
      public void testExhaust_readable() throws IOException {
        CharBuffer buf = CharBuffer.wrap(ASCII);
        assertEquals(ASCII.length(), CharStreams.exhaust(buf));
        assertEquals(0, buf.remaining());
        assertEquals(0, CharStreams.exhaust(buf));
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 21 14:28:19 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/io/MultiReaderTest.java

        String expected = begin + end;
        assertEquals(expected.charAt(0), joinedReader.read());
        CharStreams.skipFully(joinedReader, 1);
        assertEquals(expected.charAt(2), joinedReader.read());
        CharStreams.skipFully(joinedReader, 4);
        assertEquals(expected.charAt(7), joinedReader.read());
        CharStreams.skipFully(joinedReader, 1);
        assertEquals(expected.charAt(9), joinedReader.read());
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 3.7K bytes
    - Viewed (0)
Back to top