1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| import java.io.*;
import java.net.*;
public class analyseur {
public static void main (String[] args) throws IOException {
int i=0,c,
String s=null;
String r=null;
BufferedReader br =
new BufferedReader(new InputStreamReader( System.in));
tab[i]=s;
try{
System.out.println("URL?");
s=br.readLine();
}
catch (IOException e) {
System.out.println("Erreur de lecture de la console.");
System.exit(0);
}
r=s;
tab[i]=r;System.out.println("URL"+i+"="+tab[i]);
System.out.println("les balises utiliser dans cette URL sont:");
URL urlval=null;
try{
urlval= new URL(tab[i]);
}
catch(MalformedURLException e) {
System.out.println("Erreur d'URL.");
System.exit(0);
}
FileReader entree = new FileReader(urlval.getFile());
while ((c = entree.read()) != -1)
{
s="#";
if (c==(int)'<')
{
do
{s=s+(char)c;
c = entree.read();
}
while ((c!=(int)'>')&&(c!=-1));
if (c==(int)'>')
s=s+'>';
else break;
System.out.println(s); |
Partager