private static void consumeIDs(URLConnection connection, FastIDSet result) throws IOException { BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { String line; while ((line = reader.readLine()) != null) { result.add(Long.parseLong(line)); } } finally { reader.close(); } }
private static List<RecommendedItem> consumeItems(URLConnection connection) throws IOException { List<RecommendedItem> result = Lists.newArrayList(); BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { CharSequence line; while ((line = reader.readLine()) != null) { Iterator<String> tokens = COMMA.split(line).iterator(); long itemID = Long.parseLong(tokens.next()); float value = LangUtils.parseFloat(tokens.next()); result.add(new GenericRecommendedItem(itemID, value)); } } finally { reader.close(); } return result; }
switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_OK: BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { return Integer.parseInt(reader.readLine());
switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_OK: BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { float[] result = new float[itemIDs.length];
switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_OK: BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { return LangUtils.parseFloat(reader.readLine());
switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_OK: BufferedReader reader = IOUtils.bufferStream(connection.getInputStream()); try { float[] result = new float[itemIDs.length];