Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for isProbablyUtf8 (0.43 sec)

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

    /**
     * Returns true if the body in question probably contains human readable text. Uses a small
     * sample of code points to detect unicode control characters commonly used in binary file
     * signatures.
     */
    fun Buffer.isProbablyUtf8(): Boolean {
      try {
        val prefix = Buffer()
        val byteCount = size.coerceAtMost(64)
        copyTo(prefix, 0, byteCount)
        for (i in 0 until 16) {
          if (prefix.exhausted()) {
            break
          }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Jan 07 16:05:34 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  2. okhttp-logging-interceptor/src/test/java/okhttp3/logging/IsProbablyUtf8Test.kt

    import assertk.assertions.isTrue
    import okhttp3.logging.internal.isProbablyUtf8
    import okio.Buffer
    import org.junit.jupiter.api.Test
    
    class IsProbablyUtf8Test {
      @Test fun isProbablyUtf8() {
        assertThat(Buffer().isProbablyUtf8()).isTrue()
        assertThat(Buffer().writeUtf8("abc").isProbablyUtf8()).isTrue()
        assertThat(Buffer().writeUtf8("new\r\nlines").isProbablyUtf8()).isTrue()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  3. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

    import okhttp3.OkHttpClient
    import okhttp3.Response
    import okhttp3.internal.charsetOrUtf8
    import okhttp3.internal.http.promisesBody
    import okhttp3.internal.platform.Platform
    import okhttp3.logging.internal.isProbablyUtf8
    import okio.Buffer
    import okio.GzipSource
    
    /**
     * An OkHttp interceptor which logs request and response information. Can be applied as an
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
Back to top