Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for source (0.16 sec)

  1. samples/slack/src/main/java/okhttp3/slack/SlackApi.java

        Call call = httpClient.newCall(request);
        try (Response response = call.execute()) {
          JsonAdapter<OAuthSession> jsonAdapter = moshi.adapter(OAuthSession.class);
          return jsonAdapter.fromJson(response.body().source());
        }
      }
    
      /** See https://api.slack.com/methods/rtm.start. */
      public RtmStartResponse rtmStart(String accessToken) throws IOException {
        HttpUrl url = baseUrl.newBuilder("rtm.start")
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 19:30:55 GMT 2018
    - 4.4K 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. samples/guide/src/main/java/okhttp3/recipes/PrintEvents.java

          }
    
          @Override public void onResponse(Call call, Response response) throws IOException {
            try (ResponseBody body = response.body()) {
              // Consume and discard the response body.
              body.source().readByteString();
            }
          }
        });
    
        Request newYorkTimesRequest = new Request.Builder()
            .url("https://www.nytimes.com/")
            .build();
    Java
    - Registered: Fri May 03 11:42:14 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/PrintEventsNonConcurrent.java

          // Consume and discard the response body.
          response.body().source().readByteString();
        }
    
        System.out.println("REQUEST 2 (pooled connection)");
        try (Response response = client.newCall(request).execute()) {
          // Consume and discard the response body.
          response.body().source().readByteString();
        }
      }
    
      public static void main(String... args) throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 5.3K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/Progress.java

          return responseBody.contentLength();
        }
    
        @Override public BufferedSource source() {
          if (bufferedSource == null) {
            bufferedSource = Okio.buffer(source(responseBody.source()));
          }
          return bufferedSource;
        }
    
        private Source source(Source source) {
          return new ForwardingSource(source) {
            long totalBytesRead = 0L;
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 3.9K bytes
    - Viewed (0)
  6. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

          ResponseBody body = response.body();
          List<Contributor> contributors = CONTRIBUTORS_JSON_ADAPTER.fromJson(body.source());
    
          // Sort list by the most contributions.
          Collections.sort(contributors, (c1, c2) -> c2.contributions - c1.contributions);
    
          // Output list of contributors.
          for (Contributor contributor : contributors) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  7. 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)
  8. samples/guide/src/main/java/okhttp3/recipes/ParseResponseWithMoshi.java

        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          Gist gist = gistJsonAdapter.fromJson(response.body().source());
    
          for (Map.Entry<String, GistFile> entry : gist.files.entrySet()) {
            System.out.println(entry.getKey());
            System.out.println(entry.getValue().content);
          }
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.8K bytes
    - Viewed (0)
Back to top