Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for WriteAll (0.19 sec)

  1. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

                gzippedLength = buffer.size
                GzipSource(buffer).use { gzippedResponseBody ->
                  buffer = Buffer()
                  buffer.writeAll(gzippedResponseBody)
                }
              }
    
              val charset: Charset = requestBody.contentType().charsetOrUtf8()
    
              logger.log("")
              if (!buffer.isProbablyUtf8()) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  2. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

            .setBody(fileToBytes(file))
            .addHeader("content-type: " + contentType(path));
      }
    
      private Buffer fileToBytes(File file) throws IOException {
        Buffer result = new Buffer();
        result.writeAll(Okio.source(file));
        return result;
      }
    
      private String contentType(String path) {
        if (path.endsWith(".png")) return "image/png";
        if (path.endsWith(".jpg")) return "image/jpeg";
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Jan 02 02:50:44 GMT 2019
    - 4.7K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/internal/publicsuffix/PublicSuffixListGenerator.kt

      private suspend fun updateLocalFile() =
        withContext(Dispatchers.IO) {
          client.newCall(request).executeAsync().use { response ->
            fileSystem.sink(publicSuffixListDotDat).buffer().use { sink ->
              sink.writeAll(response.body.source())
            }
          }
        }
    
      private suspend fun readImportResults(): ImportResults =
        withContext(Dispatchers.IO) {
          val sortedRules: SortedSet<ByteString> = TreeSet()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 6K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/RequestBody.kt

            override fun isOneShot(): Boolean = true
    
            override fun writeTo(sink: BufferedSink) {
              FileInputStream(this@toRequestBody).use {
                sink.buffer.writeAll(it.source())
              }
            }
          }
        }
    
        /** Returns a new request body that transmits this. */
        @JvmOverloads
        @JvmStatic
        @JvmName("create")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Jan 25 14:41:37 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/ws/MessageInflater.kt

      @Throws(IOException::class)
      fun inflate(buffer: Buffer) {
        require(deflatedBytes.size == 0L)
    
        if (noContextTakeover) {
          inflater.reset()
        }
    
        deflatedBytes.writeAll(buffer)
        deflatedBytes.writeInt(OCTETS_TO_ADD_BEFORE_INFLATION)
    
        val totalBytesToRead = inflater.bytesRead + deflatedBytes.size
    
        // We cannot read all, as the source does not close.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/PostStreamingWithPipe.java

          return sink;
        }
    
        @Override public MediaType contentType() {
          return MEDIA_TYPE_MARKDOWN;
        }
    
        @Override public void writeTo(BufferedSink sink) throws IOException {
          sink.writeAll(pipe.source());
        }
      }
    
      public static void main(String... args) throws Exception {
        new PostStreamingWithPipe().run();
      }
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 3.1K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/internal/http2/Http2Test.kt

        writeMedium(frame, headerBytes.size.toInt())
        frame.writeByte(Http2.TYPE_HEADERS)
        frame.writeByte(FLAG_END_HEADERS or FLAG_END_STREAM)
        frame.writeInt(expectedStreamId and 0x7fffffff)
        frame.writeAll(headerBytes)
    
        // Check writer sends the same bytes.
        assertThat(sendHeaderFrames(true, sentHeaders)).isEqualTo(frame)
        reader.nextFrame(
          requireSettings = false,
          object : BaseTestHandler() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 28.1K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt

            ******@****.***ck {
              if (closed) {
                receiveBuffer.clear()
              } else {
                val wasEmpty = readBuffer.size == 0L
                readBuffer.writeAll(receiveBuffer)
                if (wasEmpty) {
                  condition.signalAll()
                }
              }
            }
          }
    
          // Update the connection flow control, as this is a shared resource.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 23.2K bytes
    - Viewed (1)
  9. okhttp/src/test/java/okhttp3/internal/http2/HpackTest.kt

       */
      @Test
      fun largeHeaderValue() {
        val value = CharArray(4096)
        Arrays.fill(value, '!')
        val headerBlock = headerEntries("cookie", String(value))
        hpackWriter!!.writeHeaders(headerBlock)
        bytesIn.writeAll(bytesOut)
        hpackReader!!.readHeaders()
        assertThat(hpackReader!!.headerCount).isEqualTo(0)
        assertThat(hpackReader!!.getAndResetHeaderList()).isEqualTo(headerBlock)
      }
    
      /**
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 38.2K bytes
    - Viewed (0)
  10. mockwebserver/src/test/java/mockwebserver3/internal/http2/Http2Server.kt

          responseHeaders = responseHeaders,
          outFinished = false,
          flushHeaders = false,
        )
        file.source().use { source ->
          stream.getSink().buffer().use { sink ->
            sink.writeAll(source)
          }
        }
      }
    
      private fun contentType(file: File): String {
        return when {
          file.name.endsWith(".css") -> "text/css"
          file.name.endsWith(".gif") -> "image/gif"
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6.1K bytes
    - Viewed (0)
Back to top