Exemple #1
0
 /**
  * Add a new port to the switch
  *
  * @param line the line of the configuration file containing the port information
  */
 private void addPorts(String line) {
   String token = null;
   int i;
   try {
     if (line.startsWith("port-")) {
       StringTokenizer st = new StringTokenizer(line);
       if (st.hasMoreTokens()) {
         token = st.nextToken();
         String tmp = token.substring("port-".length(), token.length() - 1);
         i = Integer.parseInt(tmp);
         if (st.hasMoreTokens()) {
           token = st.nextToken();
           InetSocketAddress isa = SyntaxAnalyz.parseISA(token);
           setPort(i, new OurPort(isa, this));
         }
       }
     }
   } catch (NumberFormatException e) {
     System.err.println("format incorrect : <" + token + "> n\'est pas un nombre ?");
   } catch (IOException e) {
     System.err.println("Erreur d'entree sortie pendant l\'ajout d\'un port ");
   }
 }