Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for BytesRead (0.22 sec)

  1. 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;
            }
          };
        }
      }
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 3.9K bytes
    - Viewed (0)
  2. okhttp/src/main/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
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Mar 22 07:09:21 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  3. internal/s3select/progress.go

    type countUpReader struct {
    	reader    io.Reader
    	bytesRead int64
    }
    
    // Max bzip2 concurrency across calls. 50% of GOMAXPROCS.
    var bz2Limiter = pbzip2.CreateConcurrencyPool((runtime.GOMAXPROCS(0) + 1) / 2)
    
    func (r *countUpReader) Read(p []byte) (n int, err error) {
    	n, err = r.reader.Read(p)
    	atomic.AddInt64(&r.bytesRead, int64(n))
    	return n, err
    }
    
    func (r *countUpReader) BytesRead() int64 {
    	if r == nil {
    		return 0
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Oct 18 15:44:36 GMT 2021
    - 4.2K bytes
    - Viewed (0)
  4. internal/http/request-recorder.go

    	buf bytes.Buffer
    	// total bytes read including header size
    	bytesRead int
    }
    
    // Close is a no operation closer
    func (r *RequestRecorder) Close() error {
    	// no-op
    	return nil
    }
    
    // Read reads from the internal reader and counts/save the body in the memory
    func (r *RequestRecorder) Read(p []byte) (n int, err error) {
    	n, err = r.Reader.Read(p)
    	r.bytesRead += n
    
    	if r.LogBody {
    		r.buf.Write(p[:n])
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Apr 12 21:37:19 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  5. okhttp/src/main/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,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  6. okhttp/src/main/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)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  7. okhttp/src/main/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
        }
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.4K bytes
    - Viewed (0)
  8. internal/hash/reader.go

    	n, err := r.src.Read(p)
    	r.bytesRead += int64(n)
    	if r.sha256 != nil {
    		r.sha256.Write(p[:n])
    	}
    	if r.contentHasher != nil {
    		r.contentHasher.Write(p[:n])
    	}
    
    	if err == io.EOF { // Verify content SHA256, if set.
    		if r.expectedMin > 0 {
    			if r.bytesRead < r.expectedMin {
    				return 0, SizeTooSmall{Want: r.expectedMin, Got: r.bytesRead}
    			}
    		}
    		if r.expectedMax > 0 {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Sep 18 17:00:54 GMT 2023
    - 10.8K bytes
    - Viewed (0)
  9. 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
        }
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/internal/connection/Exchange.kt

      }
    
      fun <E : IOException?> bodyComplete(
        bytesRead: Long,
        responseDone: Boolean,
        requestDone: Boolean,
        e: E,
      ): E {
        if (e != null) {
          trackFailure(e)
        }
        if (requestDone) {
          if (e != null) {
            eventListener.requestFailed(call, e)
          } else {
            eventListener.requestBodyEnd(call, bytesRead)
          }
        }
        if (responseDone) {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.2K bytes
    - Viewed (2)
Back to top