Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 74 for WriteTo (0.17 sec)

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

        assertOnFileDescriptor(content = "Hello") { fd ->
          val requestBody = fd.toRequestBody()
    
          val buffer = Buffer()
          requestBody.writeTo(buffer)
          assertThat(buffer.readUtf8()).isEqualTo("Hello")
    
          assertThrows(IOException::class.java) {
            requestBody.writeTo(Buffer())
          }
        }
      }
    
      @Test
      fun testFileDescriptorAfterClose() {
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  2. okhttp/src/test/java/okhttp3/MultipartBodyTest.kt

        val buffer = Buffer()
        body.writeTo(buffer)
        assertThat(buffer.readUtf8()).isEqualTo(expected)
      }
    
      @Test
      fun streamingPartHasNoLength() {
        class StreamingBody(private val body: String) : RequestBody() {
          override fun contentType(): MediaType? {
            return null
          }
    
          @Throws(IOException::class)
          override fun writeTo(sink: BufferedSink) {
            sink.writeUtf8(body)
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  3. okhttp-testing-support/src/main/kotlin/okhttp3/ForwardingRequestBody.kt

      }
    
      @Throws(IOException::class)
      override fun contentLength(): Long {
        return delegate.contentLength()
      }
    
      @Throws(IOException::class)
      override fun writeTo(sink: BufferedSink) {
        delegate.writeTo(sink)
      }
    
      override fun isDuplex(): Boolean {
        return delegate.isDuplex()
      }
    
      override fun toString(): String {
        return javaClass.simpleName + "(" + delegate.toString() + ")"
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/RequestBody.kt

      /**
       * Returns the number of bytes that will be written to sink in a call to [writeTo],
       * or -1 if that count is unknown.
       */
      @Throws(IOException::class)
      open fun contentLength(): Long = commonContentLength()
    
      /** Writes the content of this request to [sink]. */
      @Throws(IOException::class)
      abstract fun writeTo(sink: BufferedSink)
    
      /**
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Thu Jan 25 14:41:37 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/-RequestBodyCommon.kt

      return object : RequestBody() {
        override fun contentType() = contentType
    
        override fun contentLength() = byteCount.toLong()
    
        override fun writeTo(sink: BufferedSink) {
          sink.write(this@commonToRequestBody, offset, byteCount)
        }
      }
    }
    
    @Suppress("unused")
    fun RequestBody.commonContentLength(): Long = -1L
    
    @Suppress("unused")
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/FormBodyTest.kt

        val out = Buffer()
        body.writeTo(out)
        assertThat(out.readUtf8()).isEqualTo(expected)
      }
    
      @Test
      fun encodedPair() {
        val body =
          FormBody.Builder()
            .add("sim", "ple")
            .build()
        val expected = "sim=ple"
        assertThat(body.contentLength()).isEqualTo(expected.length.toLong())
        val buffer = Buffer()
        body.writeTo(buffer)
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

          )
    
        call.execute().use { response ->
          assertThat(response.body.string()).isEqualTo("abc")
          val requestBodyOut = requestBody.takeSink()
          assertFailsWith<IOException> {
            SlowRequestBody.writeTo(requestBodyOut)
          }
          assertFailsWith<IOException> {
            requestBodyOut.close()
          }
        }
    
        // Confirm that the connection pool was not corrupted by making another call.
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  8. okhttp-testing-support/src/main/kotlin/okhttp3/UppercaseRequestInterceptor.kt

        val uppercaseBody: RequestBody =
          object : ForwardingRequestBody(request.body) {
            @Throws(IOException::class)
            override fun writeTo(sink: BufferedSink) {
              delegate().writeTo(uppercaseSink(sink).buffer())
            }
          }
        return request.newBuilder()
          .method(request.method, uppercaseBody)
          .build()
      }
    
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  9. src/bytes/reader_test.go

    	{"ReadByte", func(r *Reader) { r.ReadByte() }},
    	{"UnreadRune", func(r *Reader) { r.UnreadRune() }},
    	{"Seek", func(r *Reader) { r.Seek(0, io.SeekCurrent) }},
    	{"WriteTo", func(r *Reader) { r.WriteTo(&Buffer{}) }},
    }
    
    func TestUnreadRuneError(t *testing.T) {
    	for _, tt := range UnreadRuneErrorTests {
    		reader := NewReader([]byte("0123456789"))
    		if _, _, err := reader.ReadRune(); err != nil {
    Go
    - Registered: Tue Apr 09 11:13:10 GMT 2024
    - Last Modified: Mon Dec 13 18:45:54 GMT 2021
    - 8K bytes
    - Viewed (0)
  10. src/bytes/reader.go

    	}
    	r.i = abs
    	return abs, nil
    }
    
    // WriteTo implements the [io.WriterTo] interface.
    func (r *Reader) WriteTo(w io.Writer) (n int64, err error) {
    	r.prevRune = -1
    	if r.i >= int64(len(r.s)) {
    		return 0, nil
    	}
    	b := r.s[r.i:]
    	m, err := w.Write(b)
    	if m > len(b) {
    		panic("bytes.Reader.WriteTo: invalid Write count")
    	}
    	r.i += int64(m)
    	n = int64(m)
    Go
    - Registered: Tue Apr 09 11:13:10 GMT 2024
    - Last Modified: Fri Oct 13 17:10:31 GMT 2023
    - 3.9K bytes
    - Viewed (0)
Back to top