Code example for Scanner

Methods: hasNextLine, nextLine

0
 
	private JsonElement getJsonFromResponse(HttpResponse response)
			throws IllegalStateException, IOException { 
		JsonElement json = null;
		if (response.getEntity() != null) {
			Scanner x = new Scanner(response.getEntity().getContent()); 
			if (x.hasNextLine()) {
				json = parser.parse(x.nextLine());
			} 
		} 
		EntityUtils.consume(response.getEntity());
		if (json == null) {
			throw new ParseException("could not parse the json");
		} 
		return json;
	} 
 
	private class Data { 
		@SuppressWarnings("unused") 
		private String create_method = "file";
		@SuppressWarnings("unused")