/[classpath]/inetlib/source/gnu/inet/nntp/ActiveTimesIterator.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/nntp/ActiveTimesIterator.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dog, Sun Oct 19 08:51:37 2003 UTC revision 1.2 by dog, Sun Oct 19 16:16:50 2003 UTC
# Line 38  import java.util.NoSuchElementException; Line 38  import java.util.NoSuchElementException;
38   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
39   * @version $Revision$ $Date$   * @version $Revision$ $Date$
40   */   */
41  public class ActiveTimesIterator  public class ActiveTimesIterator extends LineIterator
   extends LineIterator  
42  {  {
43    
44    ActiveTimesIterator(NNTPConnection connection)    ActiveTimesIterator(NNTPConnection connection)
# Line 49  public class ActiveTimesIterator Line 48  public class ActiveTimesIterator
48    
49    /**    /**
50     * Returns the next group active time.     * Returns the next group active time.
51     */       */
52    public Object next()    public Object next()
53    {    {
54      try      try
55      {      {
56        return nextGroup();        return nextGroup();
57      }      }
58      catch (IOException e)      catch(IOException e)
59      {      {
60        throw new NoSuchElementException("I/O error: "+e.getMessage());        throw new NoSuchElementException("I/O error: " + e.getMessage());
61      }      }
62    }    }
63    
64    /**    /**
65     * Returns the next group active time.     * Returns the next group active time.
66     */     */
67    public ActiveTime nextGroup()    public ActiveTime nextGroup() throws IOException
     throws IOException  
68    {    {
69      String line = nextLine();      String line = nextLine();
70        
71      // Parse line      // Parse line
72      try        try
73      {      {
74        int start = 0, end;        int start = 0, end;
75        end = line.indexOf(' ', start);          end = line.indexOf(' ', start);
76        String group = line.substring(start, end);        String group = line.substring(start, end);
77        start = end+1;          start = end + 1;
78        end = line.indexOf(' ', start);          end = line.indexOf(' ', start);
79        Date time = connection.parseDate(line.substring(start, end));        Date time = connection.parseDate(line.substring(start, end));
80        start = end+1;          start = end + 1;
81        String email = line.substring(start);        String email = line.substring(start);
82          
83        return new ActiveTime(group, time, email);          return new ActiveTime(group, time, email);
84      }      }
85      catch (ParseException e)      catch(ParseException e)
86      {      {
87        throw new IOException(e.getMessage());        throw new IOException(e.getMessage());
88      }      }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26