import com.google.soap.search.GoogleSearch; import com.google.soap.search.GoogleSearchFault; public class GoogleCache { private static String googleKey = ""; public static void main(String[] args) { // 必要であれば、Proxyを設定する。 // System.getProperties().put("http.proxyHost", ""); // System.getProperties().put("http.proxyPort", ""); if (args.length != 1) { System.err.println( "Usage: java [-classpath classpath] GoogleCache "); System.exit(1); } GoogleSearch s = new GoogleSearch(); try { s.setKey(googleKey); s.setLanguageRestricts("lang_ja"); GoogleSearch cache = new GoogleSearch(); cache.setKey(googleKey); byte [] cachedBytes = cache.doGetCachedPage( args[0] ); String cachedString = new String(cachedBytes); System.out.println(cachedString); } catch (GoogleSearchFault f) { System.out.println("GoogleSearchFault: " + f.toString()); } } }