Last active
December 27, 2015 12:09
-
-
Save bsphere/7324002 to your computer and use it in GitHub Desktop.
Revisions
-
bsphere revised this gist
Nov 5, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public String getString() throws IOException { String line; while ((line = reader.readLine()) != null) { out.append(line); } -
bsphere revised this gist
Nov 5, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ public MyHTTPClient(URL url) { public String getString() throws IOException { HTTPUrlConnection urlConnection = null; URL url = new URL(mUrl, "/string"); try { urlConnection = (HTTPUrlConnection) url.openConnection(); -
bsphere revised this gist
Nov 5, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public MyHTTPClient(URL url) { mUrl = url; } public String getString() throws IOException { HTTPUrlConnection urlConnection = null; try { -
bsphere created this gist
Nov 5, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ public class MyHTTPClient { private URL mUrl; public MyHTTPClient(URL url) { mUrl = url; } public String getSomething() throws IOException { HTTPUrlConnection urlConnection = null; try { urlConnection = (HTTPUrlConnection) url.openConnection(); InputStream in = urlConnection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder out = new StringBuilder(); String line; while ((line = reader.readLine() != null) { out.append(line); } return out.toString(); } finally { if (urlConnection != null) urlConnection.disconnect(); } return null; } }