Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for Song (0.21 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/Progress.java

          }
          return bufferedSource;
        }
    
        private Source source(Source source) {
          return new ForwardingSource(source) {
            long totalBytesRead = 0L;
    
            @Override public long read(Buffer sink, long byteCount) throws IOException {
              long bytesRead = super.read(sink, byteCount);
              // read() returns the number of bytes read, or -1 if this source is exhausted.
    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. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

        private RequestBody gzip(final RequestBody body) {
          return new RequestBody() {
            @Override public MediaType contentType() {
              return body.contentType();
            }
    
            @Override public long contentLength() {
              return -1; // We don't know the compressed length in advance!
            }
    
            @Override public void writeTo(BufferedSink sink) throws IOException {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 3.8K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/PrintEvents.java

          @Override public EventListener create(Call call) {
            long callId = nextCallId.getAndIncrement();
            System.out.printf("%04d %s%n", callId, call.request().url());
            return new PrintingEventListener(callId, System.nanoTime());
          }
        };
    
        final long callId;
        final long callStartNanos;
    
        PrintingEventListener(long callId, long callStartNanos) {
          this.callId = callId;
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 6.1K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/LoggingInterceptors.java

        @Override public Response intercept(Chain chain) throws IOException {
          long t1 = System.nanoTime();
          Request request = chain.request();
          logger.info(String.format("Sending request %s on %s%n%s",
              request.url(), chain.connection(), request.headers()));
          Response response = chain.proceed(request);
    
          long t2 = System.nanoTime();
          logger.info(String.format("Received response for %s in %.1fms%n%s",
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jan 01 15:55:32 GMT 2016
    - 2K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/PrintEventsNonConcurrent.java

      }
    
      private static final class PrintingEventListener extends EventListener {
        long callStartNanos;
    
        private void printEvent(String name) {
          long nowNanos = System.nanoTime();
          if (name.equals("callStart")) {
            callStartNanos = nowNanos;
          }
          long elapsedNanos = nowNanos - callStartNanos;
          System.out.printf("%.3f %s%n", elapsedNanos / 1000000000d, name);
        }
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 5.3K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/CancelCall.java

      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build();
    
        final long startNanos = System.nanoTime();
        final Call call = client.newCall(request);
    
        // Schedule a job to cancel the call in 1 second.
        executor.schedule(() -> {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.1K bytes
    - Viewed (0)
  7. samples/crawler/src/main/java/okhttp3/sample/Crawler.java

      public static void main(String[] args) throws IOException {
        if (args.length != 2) {
          System.out.println("Usage: Crawler <cache dir> <root>");
          return;
        }
    
        int threadCount = 20;
        long cacheByteCount = 1024L * 1024L * 100L;
    
        Cache cache = new Cache(new File(args[0]), cacheByteCount);
        OkHttpClient client = new OkHttpClient.Builder()
            .cache(cache)
            .build();
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 4.6K bytes
    - Viewed (0)
Back to top