@@ -11,7 +11,7 @@ NIO is extremely efficient.
1111``` java
1212// url is the URL to download. The callback will be invoked on the UI thread
1313// once the download is complete.
14- AsyncHttpClient . getDefaultInstance(). get (url, new AsyncHttpClient .StringCallback () {
14+ AsyncHttpClient . getDefaultInstance(). getString (url, new AsyncHttpClient .StringCallback () {
1515 // Callback is invoked with any exceptions/errors, and the result, if available.
1616 @Override
1717 public void onCompleted (Exception e , AsyncHttpResponse response , String result ) {
@@ -30,7 +30,7 @@ AsyncHttpClient.getDefaultInstance().get(url, new AsyncHttpClient.StringCallback
3030``` java
3131// url is the URL to download. The callback will be invoked on the UI thread
3232// once the download is complete.
33- AsyncHttpClient . getDefaultInstance(). get (url, new AsyncHttpClient .JSONObjectCallback () {
33+ AsyncHttpClient . getDefaultInstance(). getJSONObject (url, new AsyncHttpClient .JSONObjectCallback () {
3434 // Callback is invoked with any exceptions/errors, and the result, if available.
3535 @Override
3636 public void onCompleted (Exception e , AsyncHttpResponse response , JSONObject result ) {
@@ -49,7 +49,7 @@ AsyncHttpClient.getDefaultInstance().get(url, new AsyncHttpClient.JSONObjectCall
4949### Download a url to a file
5050
5151``` java
52- AsyncHttpClient . getDefaultInstance(). get (url, filename, new AsyncHttpClient .FileCallback () {
52+ AsyncHttpClient . getDefaultInstance(). getFile (url, filename, new AsyncHttpClient .FileCallback () {
5353 @Override
5454 public void onCompleted (Exception e , AsyncHttpResponse response , File result ) {
5555 if (e != null ) {
@@ -176,15 +176,15 @@ server.listen(5000);
176176All the API calls return [Futures](http://en.wikipedia.org/wiki/Futures_and_promises).
177177
178178```java
179- Future<String> string = client.getString("https ://" + githubPath + " hello.txt");
179+ Future<String> string = client.getString("http ://foo.com/ hello.txt");
180180// this may throw!
181181String value = string.get();
182182```
183183
184184Futures can also have callbacks...
185185
186186```java
187- Future<String> string = client.getString("https ://" + githubPath + " hello.txt");
187+ Future<String> string = client.getString("http ://foo.com/ hello.txt");
188188string.setResultCallback(new FutureCallback<String>() {
189189 @Override
190190 public void onCompleted(Exception e, String result) {
@@ -196,7 +196,7 @@ string.setResultCallback(new FutureCallback<String>() {
196196For brevity...
197197
198198```java
199- client.getString("https ://" + githubPath + " hello.txt")
199+ client.getString("http ://foo.com/ hello.txt")
200200.setResultCallback(new FutureCallback<String>() {
201201 @Override
202202 public void onCompleted(Exception e, String result) {
0 commit comments