GBaseExample.java: erinevus redaktsioonide vahel
Mine navigeerimisribale
Mine otsikasti
Resümee puudub |
Resümee puudub |
||
| 30. rida: | 30. rida: | ||
in = new BufferedReader(new InputStreamReader(url.openStream())); | in = new BufferedReader(new InputStreamReader(url.openStream())); | ||
while ((inputLine = in.readLine()) != null) | |||
System.out.println(inputLine); | |||
in.close(); | |||
} | } | ||
} | } | ||
</pre> | </pre> | ||
Viimane redaktsioon: 27. september 2007, kell 02:36
/*
* Google base reading demo
*/
import java.net.*;
import java.io.*;
public class GBaseExample {
private static String SNIPPETS_FEED = "http://base.google.com/base/feeds/snippets";
private static String FREEQUERY = "book";
private static String FIXQUERY = "[product type : books][author : Shakespeare]";
private static String DEVELOPER_KEY = "";
public static void main(String[] args) throws IOException {
URL url;
BufferedReader in;
String inputLine;
url = new URL(SNIPPETS_FEED + "?bq=" + URLEncoder.encode(FIXQUERY, "UTF-8"));
//"&q=" + URLEncoder.encode(FREEQUERY, "UTF-8") +
//"&alt=json-in-script" +
//"&key=" + DEVELOPER_KEY);
in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}