KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > base > MessageRecuSplite


1 package zirc.base ;
2
3 import java.util.* ;
4
5 //zIrc, irc client.
6
// Copyright (C) 2004 CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com
7
//
8
// This program is free software; you can redistribute it and/or
9
// modify it under the terms of the GNU General Public License
10
// as published by the Free Software Foundation; either version 2
11
// of the License, or (at your option) any later version.
12
//
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
17

18 /**
19  * <p>Title: MessageRecuSplite</p>
20  * <p>Description: parse les reponses des serveurs</p>
21  * <p>Copyright: Copyright (c) 2004</p>
22  * <p>Company: CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
23  * @version 1.0
24  */

25
26 public class MessageRecuSplite extends ArrayList
27 {
28   public MessageRecuSplite(String JavaDoc _line)
29   {
30     super() ;
31
32     //garnir le arraylist avec les différentes parties de la reponse
33
StringTokenizer str = new StringTokenizer(_line, " ") ;
34
35     int i = 0 ;
36     while (str.hasMoreElements() /*&& i < 6*/)
37     {
38       add(str.nextToken()) ;
39       i++ ;
40     }
41   }
42
43   //redéfini, retourne "" si jamais on est out of bounds
44
public Object JavaDoc get(int index)
45   {
46     Object JavaDoc o ;
47     try
48     {
49       o = super.get(index) ;
50     }
51     catch (ArrayIndexOutOfBoundsException JavaDoc e)
52     {
53       return "" ;
54     }
55
56     return o ;
57   }
58
59 }
60
Popular Tags