import java.net.*; import java.io.*; import java.util.*; public class URLabi{ public static String[] lingid(String sisu) throws IOException{ Vector v=new Vector(); StringTokenizer st1=new StringTokenizer(sisu, "<>", true); while(st1.hasMoreTokens()){ if((st1.nextToken().equals("<"))&st1.hasMoreTokens()){ String juhtrida=st1.nextToken(); StringTokenizer tag=new StringTokenizer(juhtrida, " \n\t=\""); while(tag.hasMoreTokens()){ if(tag.nextToken().toLowerCase().equals("href")& tag.hasMoreTokens()){ String link=tag.nextToken(); v.addElement(link); } } } } String[] tulemus=new String[v.size()]; for(int i=0; i=0){ out.write(nr); nr=in.read(); // hulk++; // if((hulk%1000)==0)System.out.print(hulk/1000+" "); } in.close(); out.close(); }catch(Exception e){korras=false; e.printStackTrace();} return korras; } public static boolean kopeeri(String url, String urlalus, String algkataloog){ if(!url.startsWith(urlalus))return false; String failinimi=algkataloog+File.separator+url.substring(urlalus.length()). replace('/', File.separatorChar); if(failinimi.endsWith(File.separator))failinimi+="index.html"; String kataloog=failinimi.substring(0, failinimi.lastIndexOf(File.separator)); new File(kataloog).mkdirs(); return kopeeri(url, failinimi); } }