public MeetupResponse<Rsvp> getRsvps(RsvpSearchCriteria c) throws Exception { HttpURLConnection conn = createConnection(RSVPS, c.getParameterMap()); HttpRequest req = sign(conn); Type type = new TypeToken<MeetupResponse<Rsvp>>() {}.getType(); MeetupResponse<Rsvp> events = gson.fromJson(new InputStreamReader(conn.getInputStream()), type); return events; }
public JSONObject getRsvpsObject(RsvpSearchCriteria c) throws Exception { HttpURLConnection conn = createConnection(RSVPS, c.getParameterMap()); HttpRequest req = sign(conn); Type type = new TypeToken<MeetupResponse<Rsvp>>() {}.getType(); StringBuilder b = new StringBuilder(); String line = null; BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = r.readLine()) != null) { b.append(line); b.append("\n"); } return new JSONObject(b.toString()); }