I am trying to discover deployd, and i have created a simple table for data storage. The table is stored at
http://localhost:2403/table
as a JSONArray. I can get the data with the following code:
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONArray readJsonFromUrl(String url) throws IOException, JSONException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONArray json = new JSONArray(jsonText);
return json;
} finally {
is.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
JSONArray obj = readJsonFromUrl("http://localhost:2403/table");
}
My question is, this data is stored in the localhost. Let's say, i want to use this database in my android application. Then obviously i cannot use
JSONArray obj = readJsonFromUrl("http://localhost:2403/table")
to get the json array. So, how can i get it? I looked at the documentation and could not find anything. What link should i use instead of local host:2403/table?
Thanks