1 |
/* |
/* |
2 |
* $Id$ |
* ArticleNumberIterator.java |
3 |
* Copyright (C) 2003 The Free Software Foundation |
* Copyright (C) 2003 The Free Software Foundation |
4 |
* |
* |
5 |
* This file is part of GNU inetlib, a library. |
* This file is part of GNU inetlib, a library. |
45 |
* An iterator over a listing of article numbers. |
* An iterator over a listing of article numbers. |
46 |
* |
* |
47 |
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> |
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> |
|
* @version $Revision$ $Date$ |
|
48 |
*/ |
*/ |
49 |
public class ArticleNumberIterator extends LineIterator |
public class ArticleNumberIterator |
50 |
|
extends LineIterator |
51 |
{ |
{ |
52 |
|
|
53 |
ArticleNumberIterator (NNTPConnection connection) |
ArticleNumberIterator(NNTPConnection connection) |
54 |
{ |
{ |
55 |
super (connection); |
super(connection); |
56 |
} |
} |
57 |
|
|
58 |
/** |
/** |
59 |
* Returns the next article number. |
* Returns the next article number. |
60 |
*/ |
*/ |
61 |
public Object next () |
public Object next() |
62 |
{ |
{ |
63 |
try |
try |
64 |
{ |
{ |
65 |
return new Integer (nextArticleNumber ()); |
return new Integer(nextArticleNumber()); |
66 |
} |
} |
67 |
catch (IOException e) |
catch (IOException e) |
68 |
{ |
{ |
69 |
throw new NoSuchElementException ("I/O error: " + e.getMessage ()); |
throw new NoSuchElementException("I/O error: " + e.getMessage()); |
70 |
} |
} |
71 |
} |
} |
72 |
|
|
73 |
/** |
/** |
74 |
* Returns the next article number. |
* Returns the next article number. |
75 |
*/ |
*/ |
76 |
public int nextArticleNumber () throws IOException |
public int nextArticleNumber() |
77 |
|
throws IOException |
78 |
{ |
{ |
79 |
String line = nextLine (); |
String line = nextLine(); |
80 |
return Integer.parseInt (line.trim ()); |
return Integer.parseInt(line.trim()); |
81 |
} |
} |
82 |
|
|
83 |
} |
} |
84 |
|
|