Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for bytesRead (0.29 sec)

  1. src/test/java/org/codelibs/curl/io/ContentCacheTest.java

            try (InputStream stream = cache.getInputStream()) {
                assertNotNull(stream);
                byte[] buffer = new byte[1024];
                int bytesRead = stream.read(buffer);
                assertEquals(data.length, bytesRead);
    
                String result = new String(buffer, 0, bytesRead, "UTF-8");
                assertEquals(testContent, result);
            }
        }
    
        @Test
    Registered: Thu Sep 04 15:34:10 UTC 2025
    - Last Modified: Thu Jul 31 01:01:12 UTC 2025
    - 10.3K bytes
    - Viewed (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/cache2/FileOperator.kt

        }
        var mutablePos = pos
        var mutableByteCount = byteCount
    
        while (mutableByteCount > 0L) {
          val bytesRead = fileChannel.transferTo(mutablePos, mutableByteCount, sink)
          mutablePos += bytesRead
          mutableByteCount -= bytesRead
        }
      }
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/cache/CacheInterceptor.kt

                }
                throw e
              }
    
              if (bytesRead == -1L) {
                if (!cacheRequestClosed) {
                  cacheRequestClosed = true
                  cacheBody.close() // The cache response is complete!
                }
                return -1
              }
    
              sink.copyTo(cacheBody.buffer, sink.size - bytesRead, bytesRead)
              cacheBody.emitCompleteSegments()
              return bytesRead
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 10.3K bytes
    - Viewed (0)
  4. src/test/java/org/codelibs/curl/CurlResponseTest.java

                assertNotNull(stream);
                byte[] buffer = new byte[1024];
                int bytesRead = stream.read(buffer);
                assertEquals(data.length, bytesRead);
                assertArrayEquals(data, Arrays.copyOf(buffer, bytesRead));
            }
        }
    
        @Test
        public void testGetContentAsStreamWithoutCache() {
            CurlResponse response = new CurlResponse();
    Registered: Thu Sep 04 15:34:10 UTC 2025
    - Last Modified: Thu Jul 31 01:01:12 UTC 2025
    - 11.5K bytes
    - Viewed (0)
  5. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/ws/MessageInflater.kt

        val totalBytesToRead = inflater.bytesRead + deflatedBytes.size
    
        // We cannot read all, as the source does not close.
        // Instead, we ensure that all bytes from source have been processed by inflater.
        do {
          inflaterSource.readOrInflate(buffer, Long.MAX_VALUE)
        } while (inflater.bytesRead < totalBytesToRead && !inflater.finished())
      }
    
      @Throws(IOException::class)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  6. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/cache2/Relay.kt

              commit(upstreamPos)
              return -1L
            }
    
            // Update this source and prepare this call's result.
            val bytesRead = minOf(upstreamBytesRead, byteCount)
            upstreamBuffer.copyTo(sink, 0, bytesRead)
            sourcePos += bytesRead
    
            // Append the upstream bytes to the file.
            fileOperator!!.write(
              FILE_HEADER_SIZE + upstreamPos,
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed May 28 17:15:47 UTC 2025
    - 11.8K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/Progress.java

              long bytesRead = super.read(sink, byteCount);
              // read() returns the number of bytes read, or -1 if this source is exhausted.
              totalBytesRead += bytesRead != -1 ? bytesRead : 0;
              progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
              return bytesRead;
            }
          };
        }
      }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jan 12 03:31:36 UTC 2019
    - 3.9K bytes
    - Viewed (0)
  8. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/Exchange.kt

      fun bodyComplete(
        bytesRead: Long = -1L,
        responseDone: Boolean = false,
        requestDone: Boolean = false,
        e: IOException?,
      ): IOException? {
        if (e != null) {
          trackFailure(e)
        }
        if (requestDone) {
          if (e != null) {
            eventListener.requestFailed(call, e)
          } else {
            eventListener.requestBodyEnd(call, bytesRead)
          }
        }
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 22:04:11 UTC 2025
    - 9.7K bytes
    - Viewed (0)
  9. okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/MessageDeflaterInflaterTest.kt

      }
    
      /**
       * We had a bug where self-finishing inflater streams would infinite loop!
       * https://github.com/square/okhttp/issues/8078
       */
      @Test fun `inflate returns finished before bytesRead reaches input length`() {
        val inflater = MessageInflater(false)
        val message = "53621260020000".decodeHex()
        assertThat(inflater.inflate(message)).isEqualTo("22021002".decodeHex())
      }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 5K bytes
    - Viewed (0)
  10. okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der/DerReader.kt

      private class CountingSource(
        source: Source,
      ) : ForwardingSource(source) {
        var bytesRead = 0L
    
        override fun read(
          sink: Buffer,
          byteCount: Long,
        ): Long {
          val result = delegate.read(sink, byteCount)
          if (result == -1L) return -1L
          bytesRead += result
          return result
        }
      }
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 10.5K bytes
    - Viewed (0)
Back to top