Merged race scaling with Http Match Discovery.
This commit is contained in:
@@ -9,10 +9,16 @@ import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* Created by Gondr on 23/05/2017.
|
||||
* A helper class that has functions to read information from a url to json object.
|
||||
*/
|
||||
public class JsonReader {
|
||||
|
||||
/**
|
||||
* Reads all data from a Reader
|
||||
* @param rd reader to read from
|
||||
* @return string that the reader has currently read
|
||||
* @throws IOException if the reader is invalid
|
||||
*/
|
||||
private static String readAll(Reader rd) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int cp;
|
||||
@@ -22,6 +28,13 @@ public class JsonReader {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a Json Object from a URL
|
||||
* @param url url to read from
|
||||
* @return JSONObject that has been read
|
||||
* @throws IOException if the reader cannot obtain information
|
||||
* @throws JSONException if the read information is not json parsable.
|
||||
*/
|
||||
public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
|
||||
InputStream is = new URL(url).openStream();
|
||||
try {
|
||||
@@ -36,6 +49,13 @@ public class JsonReader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a Json Array from a URL
|
||||
* @param url url to read from
|
||||
* @return JSONArray that has been read
|
||||
* @throws IOException if the reader cannot obtain information
|
||||
* @throws JSONException if the read information is not json parsable.
|
||||
*/
|
||||
public static JSONArray readJsonFromUrlArray(String url) throws IOException, JSONException {
|
||||
InputStream is = new URL(url).openStream();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user