import java.net.*; import java.io.*; import java.util.StringTokenizer; public class Vasted{ public static void main(String argumendid[]) throws IOException{ BufferedReader sisse=new BufferedReader(new FileReader("Andmed.txt")); String andmed=sisse.readLine(); String kokku1=""; String lause="No words relevant to your query found"; while (andmed!=null){ String aadress="http://www.ibs.ee/dict/translate.cgi?word="+andmed+"&language=Estonia"; String volinikuaadress="cache.haapsalu.ee"; String volinikuvarat="3128"; System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", volinikuaadress); System.getProperties().put("proxyPort", volinikuvarat); BufferedReader sisse1=new BufferedReader(new InputStreamReader(new URL(aadress).openStream())); PrintWriter fail=new PrintWriter(new FileWriter("Vasted.txt")); String kokku=""; String rida=sisse1.readLine(); while(rida!=null){ kokku=kokku+rida; rida=sisse1.readLine(); } if(kokku.indexOf(lause)>=0){ kokku1=kokku1+(andmed+" - vaste puudub"+"\n"); } else{ kokku1=kokku1+(andmed+" - vaste leidub"+"\n"); } fail.println(kokku1); sisse1.close(); fail.close(); andmed=sisse.readLine(); } sisse.close(); } }