Bonjour,
J'ai un fichier texte rempli comme suivant:

PC1#192.168.3.10#80#21#25#8000#3306#
PC2#192.168.3.20#80#21#25#8000#3306#
PC3#192.168.3.30#80#21#25#8000#3306#


j'ai J'ai stocké chaque champ limité par un "#" dans un arraylist (chaque ligne représente une ligne de l'arraylist)
-le premier case de grand arraylist est une arraylist qui contient le premier ligne de fichier tel qu'il est
-le deuxieme case de fichier et un tableau d'entier qui contient le resultat de scan des ports 80, 21... 0 ou 1.
ma probleme que j'ai pas arrivé a affiché le contenu de cette arraylist

voila mes classes
ArrayScan.class
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
package ar;
import ar.PScanner;
import java.io.*;
import java.net.InetAddress;
 
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
 
import java.util.*;
import java.util.Scanner;
import java.util.regex.Pattern;
public class ArrayScan {
 
 
 
 
 
 
  public  static ArrayList RemplirArray(String fl ) throws FileNotFoundException, UnknownHostException
{
	PScanner p=new PScanner();
         ArrayList rows=new ArrayList() ;
	 ArrayList cols=new ArrayList() ; 
        int[] status = null;
        Scanner scanner=null;  
        String champ;
        scanner= new Scanner(new File(fl));
        while (scanner.hasNextLine()) 
          { 
            String line = scanner.nextLine();  
            Scanner s=new Scanner(line);
            s.useDelimiter(Pattern.compile("#"));
            //cols=new ArrayList() ;
 
            while (s.hasNext())
            {
                   champ=s.next();
                   if(!champ.equals("null"))  
                   cols.add(champ);
            }
             int j=0;
             InetAddress ia=null;
             for(int i=2;i<cols.size();i++)
            {
 
                     int port1=Integer.parseInt((String) cols.get(i));
                     ia = InetAddress.getByName((String) cols.get(1));
                     status[j]=p.scan(ia,port1);
                    j++;
            }
 
             rows.add(cols) ;
             rows.add(status);
            s.close();
        }
       return rows ;
}
 
 
}
PScanner.class
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
package ar;
 
import java.net.*;
import java.io.IOException;
 
 public class PScanner {
        public static int scan( InetAddress remote,int port1)
        {       
        int b=1;
        String hostname = remote.getHostName();
        try {
                 Socket s1 = new Socket(hostname,port1);
 
                 b=1;
                 s1.close();
            }
                 catch (IOException ex)
                 {
                 b=0;
                 }
        return b;
           }
 
 
}
Main .class
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
 
/*
 * Main.java
 *
 * Created on 18 mai 2009, 09:34
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
 
package ar;
 
import java.io.FileNotFoundException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Vector;
 
/**
 *
 * @author Amine
 */
public class Main {
 
    /** Creates a new instance of Main */
    public Main() {
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, UnknownHostException
    {
         ArrayList ls=new ArrayList();
         //ArrayList cols=new ArrayList();
         //Vector v=new Vector();
        ArrayScan as=new ArrayScan();
        ls=as.RemplirArray("c:\\test.txt");
 
 
 
	for (int i=0; i<ls.size();i++)
	{
		for (int j=0; j<ls.size();j=j+2)
                {
                    System.out.println(ls.get(i)+"\n");
 
                }
        }
    }  
}
merci